Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit e8962e9

Browse files
committed
✨ Set up default environment for kubectl, crictl, etc.
Update docker and k8s debian key registrations Add crictl default container runtime configuration Install kubetail on ubuntu 20+ export DEBIAN_FRONTEND=noninteractive once Configure containerd to use Systemd cgroups Configure containerd to use the pause image of installed k8s Signed-off-by: Chris Privitere <[email protected]>
1 parent ed51d7b commit e8962e9

File tree

5 files changed

+219
-53
lines changed

5 files changed

+219
-53
lines changed

templates/cluster-template-crs-cni.yaml

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
cloud-provider: external
3131
provider-id: equinixmetal://{{ `{{ v1.instance_id }}` }}
3232
preKubeadmCommands:
33-
- |
33+
- |-
3434
sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
3535
swapoff -a
3636
mount -a
@@ -46,14 +46,27 @@ spec:
4646
net.bridge.bridge-nf-call-ip6tables = 1
4747
EOF
4848
sysctl --system
49-
apt-get -y update
50-
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
51-
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
52-
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
49+
export DEBIAN_FRONTEND=noninteractive
50+
apt-get update -y
51+
apt-get remove -y docker docker-engine docker.io containerd runc
52+
apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
53+
mkdir -p /etc/apt/keyrings
54+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
55+
curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
56+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
57+
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
5358
apt-get update -y
5459
TRIMMED_KUBERNETES_VERSION=$(echo {{ .kubernetesVersion }} | sed 's/\./\\\\./g' | sed 's/^v//')
55-
RESOLVED_KUBERNETES_VERSION=$(apt-cache policy kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$1~ VERSION { print $1 }' | head -n1)
56-
DEBIAN_FRONTEND=noninteractive apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
60+
RESOLVED_KUBERNETES_VERSION=$(apt-cache madison kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$3~ VERSION { print $3 }' | head -n1)
61+
apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
62+
cat <<EOF > /etc/crictl.yaml
63+
runtime-endpoint: unix:///run/containerd/containerd.sock
64+
image-endpoint: unix:///run/containerd/containerd.sock
65+
EOF
66+
containerd config default > /etc/containerd/config.toml
67+
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
68+
sed -i "s,sandbox_image.*$,sandbox_image = $(kubeadm config images list | grep pause | sort -r | head -n1)," /etc/containerd/config.toml
69+
systemctl restart containerd
5770
---
5871
apiVersion: cluster.x-k8s.io/v1beta1
5972
kind: Cluster
@@ -146,6 +159,11 @@ spec:
146159
systemctl restart networking
147160
if [ -f "/run/kubeadm/kubeadm.yaml" ]; then
148161
export KUBECONFIG=/etc/kubernetes/admin.conf
162+
mkdir -p /root/.kube && cp -f $${KUBECONFIG} /root/.kube/config
163+
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> /root/.bashrc
164+
echo "source <(kubectl completion bash)" >> /root/.bashrc
165+
echo "alias k=kubectl" >> /root/.bashrc
166+
echo "complete -o default -F __start_kubectl k" >> /root/.bashrc
149167
export CPEM_YAML=https://github.com/equinix/cloud-provider-equinix-metal/releases/download/v3.5.0/deployment.yaml
150168
export SECRET_DATA='cloud-sa.json=''{"apiKey": "{{ .apiKey }}","projectID": "${PROJECT_ID}", "eipTag": "cluster-api-provider-packet:cluster-id:${CLUSTER_NAME}", "eipHealthCheckUseHostIP": true}'''
151169
kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}" || (sleep 1 && kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}") || (sleep 1 && kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}")
@@ -168,14 +186,31 @@ spec:
168186
net.bridge.bridge-nf-call-ip6tables = 1
169187
EOF
170188
sysctl --system
171-
apt-get -y update
172-
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
173-
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
174-
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
189+
export DEBIAN_FRONTEND=noninteractive
190+
apt-get update -y
191+
apt-get remove -y docker docker-engine docker.io containerd runc
192+
apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
193+
major_vers=$(lsb_release -r | awk '{ print $2 }' | cut -d. -f1)
194+
if [[ "$major_vers" -ge 20 ]]; then
195+
apt-get install -y kubetail
196+
fi
197+
mkdir -p /etc/apt/keyrings
198+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
199+
curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
200+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
201+
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
175202
apt-get update -y
176203
TRIMMED_KUBERNETES_VERSION=$(echo {{ .kubernetesVersion }} | sed 's/\./\\\\./g' | sed 's/^v//')
177204
RESOLVED_KUBERNETES_VERSION=$(apt-cache madison kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$3~ VERSION { print $3 }' | head -n1)
178-
DEBIAN_FRONTEND=noninteractive apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
205+
apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
206+
containerd config default > /etc/containerd/config.toml
207+
cat <<EOF > /etc/crictl.yaml
208+
runtime-endpoint: unix:///run/containerd/containerd.sock
209+
image-endpoint: unix:///run/containerd/containerd.sock
210+
EOF
211+
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
212+
sed -i "s,sandbox_image.*$,sandbox_image = $(kubeadm config images list | grep pause | sort -r | head -n1)," /etc/containerd/config.toml
213+
systemctl restart containerd
179214
ping -c 3 -q {{ .controlPlaneEndpoint }} && echo OK || ip addr add {{ .controlPlaneEndpoint }} dev lo
180215
machineTemplate:
181216
infrastructureRef:

templates/cluster-template-kube-vip-crs-cni.yaml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,27 @@ spec:
4646
net.bridge.bridge-nf-call-ip6tables = 1
4747
EOF
4848
sysctl --system
49-
apt-get -y update
50-
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
51-
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
52-
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
49+
export DEBIAN_FRONTEND=noninteractive
50+
apt-get update -y
51+
apt-get remove -y docker docker-engine docker.io containerd runc
52+
apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
53+
mkdir -p /etc/apt/keyrings
54+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
55+
curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
56+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
57+
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
5358
apt-get update -y
5459
TRIMMED_KUBERNETES_VERSION=$(echo {{ .kubernetesVersion }} | sed 's/\./\\\\./g' | sed 's/^v//')
5560
RESOLVED_KUBERNETES_VERSION=$(apt-cache madison kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$3~ VERSION { print $3 }' | head -n1)
56-
DEBIAN_FRONTEND=noninteractive apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
61+
apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
62+
cat <<EOF > /etc/crictl.yaml
63+
runtime-endpoint: unix:///run/containerd/containerd.sock
64+
image-endpoint: unix:///run/containerd/containerd.sock
65+
EOF
66+
containerd config default > /etc/containerd/config.toml
67+
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
68+
sed -i "s,sandbox_image.*$,sandbox_image = $(kubeadm config images list | grep pause | sort -r | head -n1)," /etc/containerd/config.toml
69+
systemctl restart containerd
5770
---
5871
apiVersion: cluster.x-k8s.io/v1beta1
5972
kind: Cluster
@@ -139,6 +152,11 @@ spec:
139152
- |-
140153
if [ -f "/run/kubeadm/kubeadm.yaml" ]; then
141154
export KUBECONFIG=/etc/kubernetes/admin.conf
155+
mkdir -p /root/.kube && cp -f $${KUBECONFIG} /root/.kube/config
156+
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> /root/.bashrc
157+
echo "source <(kubectl completion bash)" >> /root/.bashrc
158+
echo "alias k=kubectl" >> /root/.bashrc
159+
echo "complete -o default -F __start_kubectl k" >> /root/.bashrc
142160
export CPEM_YAML=https://github.com/equinix/cloud-provider-equinix-metal/releases/download/v3.5.0/deployment.yaml
143161
export SECRET_DATA='cloud-sa.json=''{"apiKey": "{{ .apiKey }}","projectID": "${PROJECT_ID}", "loadbalancer": "kube-vip://", "facility": "${FACILITY}"}'''
144162
kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}" || (sleep 1 && kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}") || (sleep 1 && kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}")
@@ -161,14 +179,28 @@ spec:
161179
net.bridge.bridge-nf-call-ip6tables = 1
162180
EOF
163181
sysctl --system
164-
apt-get -y update
165-
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
166-
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
167-
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
182+
export DEBIAN_FRONTEND=noninteractive
183+
apt-get update -y
184+
apt-get remove -y docker docker-engine docker.io containerd runc
185+
apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
186+
mkdir -p /etc/apt/keyrings
187+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
188+
curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
189+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
190+
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
168191
apt-get update -y
169192
TRIMMED_KUBERNETES_VERSION=$(echo {{ .kubernetesVersion }} | sed 's/\./\\\\./g' | sed 's/^v//')
170193
RESOLVED_KUBERNETES_VERSION=$(apt-cache madison kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$3~ VERSION { print $3 }' | head -n1)
171-
DEBIAN_FRONTEND=noninteractive apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
194+
apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
195+
cat <<EOF > /etc/crictl.yaml
196+
runtime-endpoint: unix:///run/containerd/containerd.sock
197+
image-endpoint: unix:///run/containerd/containerd.sock
198+
EOF
199+
containerd config default > /etc/containerd/config.toml
200+
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
201+
sed -i "s,sandbox_image.*$,sandbox_image = $(kubeadm config images list | grep pause | sort -r | head -n1)," /etc/containerd/config.toml
202+
systemctl restart containerd
203+
ping -c 3 -q {{ .controlPlaneEndpoint }} && echo OK || ip addr add {{ .controlPlaneEndpoint }} dev lo
172204
curl -o /run/metadata.json -fsSL https://metadata.platformequinix.com/metadata
173205
for i in $(cat /run/metadata.json | jq -r '.bgp_neighbors[0].peer_ips[]'); do
174206
ip route add $i via $(cat /run/metadata.json | jq -r '.network.addresses[] | select(.public == false and .address_family == 4) | .gateway')

templates/cluster-template-kube-vip.yaml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,27 @@ spec:
2727
net.bridge.bridge-nf-call-ip6tables = 1
2828
EOF
2929
sysctl --system
30-
apt-get -y update
31-
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
32-
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
33-
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
30+
export DEBIAN_FRONTEND=noninteractive
31+
apt-get update -y
32+
apt-get remove -y docker docker-engine docker.io containerd runc
33+
apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
34+
mkdir -p /etc/apt/keyrings
35+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
36+
curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
37+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
38+
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
3439
apt-get update -y
3540
TRIMMED_KUBERNETES_VERSION=$(echo {{ .kubernetesVersion }} | sed 's/\./\\\\./g' | sed 's/^v//')
3641
RESOLVED_KUBERNETES_VERSION=$(apt-cache madison kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$3~ VERSION { print $3 }' | head -n1)
37-
DEBIAN_FRONTEND=noninteractive apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
42+
apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
43+
cat <<EOF > /etc/crictl.yaml
44+
runtime-endpoint: unix:///run/containerd/containerd.sock
45+
image-endpoint: unix:///run/containerd/containerd.sock
46+
EOF
47+
containerd config default > /etc/containerd/config.toml
48+
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
49+
sed -i "s,sandbox_image.*$,sandbox_image = $(kubeadm config images list | grep pause | sort -r | head -n1)," /etc/containerd/config.toml
50+
systemctl restart containerd
3851
---
3952
apiVersion: cluster.x-k8s.io/v1beta1
4053
kind: Cluster
@@ -118,6 +131,11 @@ spec:
118131
- |-
119132
if [ -f "/run/kubeadm/kubeadm.yaml" ]; then
120133
export KUBECONFIG=/etc/kubernetes/admin.conf
134+
mkdir -p /root/.kube && cp -f $${KUBECONFIG} /root/.kube/config
135+
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> /root/.bashrc
136+
echo "source <(kubectl completion bash)" >> /root/.bashrc
137+
echo "alias k=kubectl" >> /root/.bashrc
138+
echo "complete -o default -F __start_kubectl k" >> /root/.bashrc
121139
export CPEM_YAML=https://github.com/equinix/cloud-provider-equinix-metal/releases/download/v3.5.0/deployment.yaml
122140
export SECRET_DATA='cloud-sa.json=''{"apiKey": "{{ .apiKey }}","projectID": "${PROJECT_ID}", "loadbalancer": "kube-vip://", "facility": "${FACILITY}"}'''
123141
kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}" || (sleep 1 && kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}") || (sleep 1 && kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}")
@@ -140,14 +158,28 @@ spec:
140158
net.bridge.bridge-nf-call-ip6tables = 1
141159
EOF
142160
sysctl --system
143-
apt-get -y update
144-
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
145-
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
146-
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
161+
export DEBIAN_FRONTEND=noninteractive
162+
apt-get update -y
163+
apt-get remove -y docker docker-engine docker.io containerd runc
164+
apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release linux-generic jq
165+
mkdir -p /etc/apt/keyrings
166+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
167+
curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
168+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
169+
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
147170
apt-get update -y
148171
TRIMMED_KUBERNETES_VERSION=$(echo {{ .kubernetesVersion }} | sed 's/\./\\\\./g' | sed 's/^v//')
149172
RESOLVED_KUBERNETES_VERSION=$(apt-cache madison kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$3~ VERSION { print $3 }' | head -n1)
150-
DEBIAN_FRONTEND=noninteractive apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
173+
apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
174+
cat <<EOF > /etc/crictl.yaml
175+
runtime-endpoint: unix:///run/containerd/containerd.sock
176+
image-endpoint: unix:///run/containerd/containerd.sock
177+
EOF
178+
containerd config default > /etc/containerd/config.toml
179+
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
180+
sed -i "s,sandbox_image.*$,sandbox_image = $(kubeadm config images list | grep pause | sort -r | head -n1)," /etc/containerd/config.toml
181+
systemctl restart containerd
182+
ping -c 3 -q {{ .controlPlaneEndpoint }} && echo OK || ip addr add {{ .controlPlaneEndpoint }} dev lo
151183
curl -o /run/metadata.json -fsSL https://metadata.platformequinix.com/metadata
152184
for i in $(cat /run/metadata.json | jq -r '.bgp_neighbors[0].peer_ips[]'); do
153185
ip route add $i via $(cat /run/metadata.json | jq -r '.network.addresses[] | select(.public == false and .address_family == 4) | .gateway')

0 commit comments

Comments
 (0)