diff --git a/examples/k8s.yaml b/examples/k8s.yaml index 50d709136b6..5ded00505d2 100644 --- a/examples/k8s.yaml +++ b/examples/k8s.yaml @@ -71,6 +71,24 @@ provision: rm -f /etc/cni/net.d/*.conf* apt-get install -y kubelet kubeadm kubectl && apt-mark hold kubelet kubeadm kubectl systemctl enable --now kubelet +- mode: system + script: | + #!/bin/bash + set -eux -o pipefail + grep SystemdCgroup /etc/containerd/config.toml && exit 0 + grep "version = 2" /etc/containerd/config.toml || exit 1 + # Configuring a cgroup driver + cat <>/etc/containerd/config.toml + [plugins] + [plugins."io.containerd.grpc.v1.cri"] + [plugins."io.containerd.grpc.v1.cri".containerd] + [plugins."io.containerd.grpc.v1.cri".containerd.runtimes] + [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] + runtime_type = "io.containerd.runc.v2" + [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] + SystemdCgroup = true + EOF + systemctl restart containerd - mode: system script: | #!/bin/bash @@ -80,7 +98,25 @@ provision: kubeadm config images list kubeadm config images pull --cri-socket=unix:///run/containerd/containerd.sock # Initializing your control-plane node - kubeadm init --cri-socket=unix:///run/containerd/containerd.sock --pod-network-cidr=10.244.0.0/16 --apiserver-cert-extra-sans 127.0.0.1 + cat <kubeadm-config.yaml + kind: InitConfiguration + apiVersion: kubeadm.k8s.io/v1beta3 + nodeRegistration: + criSocket: unix:///run/containerd/containerd.sock + --- + kind: ClusterConfiguration + apiVersion: kubeadm.k8s.io/v1beta3 + apiServer: + certSANs: # --apiserver-cert-extra-sans + - "127.0.0.1" + networking: + podSubnet: "10.244.0.0/16" # --pod-network-cidr + --- + kind: KubeletConfiguration + apiVersion: kubelet.config.k8s.io/v1beta1 + cgroupDriver: systemd + EOF + kubeadm init --config kubeadm-config.yaml # Installing a Pod network add-on kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/v0.14.0/Documentation/kube-flannel.yml # Control plane node isolation