Add a bootstrap role.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
};
|
||||
|
||||
bootstrap.manifests = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.path;
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
example = lib.literalExpression ''[ ${./files/clusterrole.yaml} ]'';
|
||||
description = "List of kubernetes manifests to load into the cluster.";
|
||||
@@ -29,8 +29,9 @@
|
||||
{
|
||||
systemd.services.kube-bootstrap = {
|
||||
enable = true;
|
||||
description = "Load initial kubernetes manifests into the cluster.";
|
||||
description = "Load initial kubernetes manifests into the cluster";
|
||||
after = [ "kubernetes.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
path = with pkgs; [
|
||||
kubectl
|
||||
];
|
||||
@@ -40,13 +41,13 @@
|
||||
};
|
||||
script =
|
||||
let
|
||||
manifests = (lib.concatMapStringsSep " " lib.escapeShellArgs config.me.bootstrap.manifests);
|
||||
manifests = (lib.concatMapStringsSep "," lib.escapeShellArg config.me.bootstrap.manifests);
|
||||
in
|
||||
''
|
||||
set -o pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
kubectl apply --server-side --force-conflicts -f ${manifests}
|
||||
kubectl --kubeconfig=/.persist/keys/kube/kubelet.kubeconfig apply --server-side --force-conflicts -f ${manifests}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
1691
nix/kubernetes/roles/bootstrap/files/cilium.yaml
Normal file
1691
nix/kubernetes/roles/bootstrap/files/cilium.yaml
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,33 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
annotations:
|
||||
rbac.authorization.kubernetes.io/autoupdate: "true"
|
||||
labels:
|
||||
kubernetes.io/bootstrapping: rbac-defaults
|
||||
name: system:kube-apiserver-to-kubelet
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes/proxy
|
||||
- nodes/stats
|
||||
- nodes/log
|
||||
- nodes/spec
|
||||
- nodes/metrics
|
||||
verbs:
|
||||
- "*"
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: system:kube-apiserver
|
||||
namespace: ""
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:kube-apiserver-to-kubelet
|
||||
subjects:
|
||||
- apiGroup: rbac.authorization.k8s.io
|
||||
kind: User
|
||||
name: kubernetes
|
||||
@@ -10,7 +10,7 @@ let
|
||||
name = "my-cni-plugins";
|
||||
paths = with pkgs; [
|
||||
cni-plugins
|
||||
cni-plugin-flannel
|
||||
# cni-plugin-flannel
|
||||
];
|
||||
};
|
||||
my-cni-configs = pkgs.callPackage ./package/cni_conf/package.nix { };
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.worker_node.enable {
|
||||
me.bootstrap.manifests = [
|
||||
"${../bootstrap/files/initial_clusterrole.yaml}"
|
||||
"${../bootstrap/files/cilium.yaml}"
|
||||
];
|
||||
me.cilium.enable = true;
|
||||
me.containerd.enable = true;
|
||||
me.firewall.enable = true;
|
||||
|
||||
Reference in New Issue
Block a user