diff --git a/templates/flavors/kubeadm/default/kubeadmConfigTemplate.yaml b/templates/flavors/kubeadm/default/kubeadmConfigTemplate.yaml index 11852b994..6c9c124b2 100644 --- a/templates/flavors/kubeadm/default/kubeadmConfigTemplate.yaml +++ b/templates/flavors/kubeadm/default/kubeadmConfigTemplate.yaml @@ -7,27 +7,6 @@ spec: template: spec: files: - - path: /etc/containerd/config.toml - content: | - version = 2 - imports = ["/etc/containerd/conf.d/*.toml"] - [plugins] - [plugins."io.containerd.grpc.v1.cri"] - sandbox_image = "registry.k8s.io/pause:3.9" - [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 - - path: /etc/modules-load.d/k8s.conf - content: | - overlay - br_netfilter - - path: /etc/sysctl.d/k8s.conf - content: | - net.bridge.bridge-nf-call-iptables = 1 - net.bridge.bridge-nf-call-ip6tables = 1 - net.ipv4.ip_forward = 1 - net.ipv6.conf.all.forwarding = 1 - path: /kubeadm-pre-init.sh content: | #!/bin/bash @@ -36,14 +15,12 @@ spec: mkdir -p -m 755 /etc/apt/keyrings PATCH_VERSION=$${1#[v]} VERSION=$${PATCH_VERSION%.*} + curl -fsSL https://raw.githubusercontent.com/linode/cluster-api-provider-linode/869bcdad9cf7daae533023c7869f62683d2a7f47/scripts/add-kubeadm-required-files.sh | bash curl -fsSL "https://pkgs.k8s.io/core:/stable:/v$VERSION/deb/Release.key" | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list apt-get update -y apt-get install -y kubelet=$PATCH_VERSION* kubeadm=$PATCH_VERSION* kubectl=$PATCH_VERSION* containerd apt-mark hold kubelet kubeadm kubectl containerd - modprobe overlay - modprobe br_netfilter - sysctl --system if [ -d "/sys/class/net/eth1" ]; then IPADDR=$(ip a s eth1 |grep 'inet ' |cut -d' ' -f6|cut -d/ -f1) sed -i "s/kubeletExtraArgs:/kubeletExtraArgs:\n node-ip: $IPADDR/g" /run/kubeadm/kubeadm.yaml diff --git a/templates/flavors/kubeadm/default/kubeadmControlPlane.yaml b/templates/flavors/kubeadm/default/kubeadmControlPlane.yaml index 3dd930ac1..e53f85939 100644 --- a/templates/flavors/kubeadm/default/kubeadmControlPlane.yaml +++ b/templates/flavors/kubeadm/default/kubeadmControlPlane.yaml @@ -12,27 +12,6 @@ spec: name: ${CLUSTER_NAME}-control-plane kubeadmConfigSpec: files: - - path: /etc/containerd/config.toml - content: | - version = 2 - imports = ["/etc/containerd/conf.d/*.toml"] - [plugins] - [plugins."io.containerd.grpc.v1.cri"] - sandbox_image = "registry.k8s.io/pause:3.9" - [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 - - path: /etc/modules-load.d/k8s.conf - content: | - overlay - br_netfilter - - path: /etc/sysctl.d/k8s.conf - content: | - net.bridge.bridge-nf-call-iptables = 1 - net.bridge.bridge-nf-call-ip6tables = 1 - net.ipv4.ip_forward = 1 - net.ipv6.conf.all.forwarding = 1 - path: /kubeadm-pre-init.sh content: | #!/bin/bash @@ -41,14 +20,12 @@ spec: mkdir -p -m 755 /etc/apt/keyrings PATCH_VERSION=$${1#[v]} VERSION=$${PATCH_VERSION%.*} + curl -fsSL https://raw.githubusercontent.com/linode/cluster-api-provider-linode/869bcdad9cf7daae533023c7869f62683d2a7f47/scripts/add-kubeadm-required-files.sh | bash curl -fsSL "https://pkgs.k8s.io/core:/stable:/v$VERSION/deb/Release.key" | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list apt-get update -y apt-get install -y kubelet=$PATCH_VERSION* kubeadm=$PATCH_VERSION* kubectl=$PATCH_VERSION* containerd apt-mark hold kubelet kubeadm kubectl containerd - modprobe overlay - modprobe br_netfilter - sysctl --system if [ -d "/sys/class/net/eth1" ]; then IPADDR=$(ip a s eth1 |grep 'inet ' |cut -d' ' -f6|cut -d/ -f1) sed -i "s/kubeletExtraArgs:/kubeletExtraArgs:\n node-ip: $IPADDR/g" /run/kubeadm/kubeadm.yaml