1. 程式人生 > 其它 >k8s 1.18.2 將docker切換為containerd

k8s 1.18.2 將docker切換為containerd

1.檢視現在的K8S狀態

[root@ecs-arm-ky-001 ~]# kubectl get nodes -o wide
NAME             STATUS   ROLES    AGE   VERSION   INTERNAL-IP     EXTERNAL-IP   OS-IMAGE                                   KERNEL-VERSION              CONTAINER-RUNTIME
ecs-arm-ky-001   Ready    master   12d   v1.18.2   192.168.0.206   <none>        Kylin Linux Advanced Server V10 (Tercel)   4.19
.90-17.5.ky10.aarch64 docker://20.10.9 ecs-arm-ky-002 Ready <none> 12d v1.18.2 192.168.0.208 <none> Kylin Linux Advanced Server V10 (Tercel) 4.19.90-17.5.ky10.aarch64 docker://20.10.9 [root@ecs-arm-ky-001 ~]#

2.在master上操作

將需要切換的node換成不可排程

[root@ecs-arm-ky-001 ~]# kubectl cordon ecs-arm-ky-002
node/ecs-arm-ky-002 cordoned [root@ecs-arm-ky-001 ~]#

3檢視狀態

[root@ecs-arm-ky-001 ~]# kubectl get node
NAME             STATUS                     ROLES    AGE   VERSION
ecs-arm-ky-001   Ready                      master   12d   v1.18.2
ecs-arm-ky-002   Ready,SchedulingDisabled   <none>   12d   v1.18.2
[root@ecs-arm-ky-001 ~]#

4.在切換引擎的Node的伺服器上操作

1.配置先決條件

cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF

sudo modprobe overlay
sudo modprobe br_netfilter

# 設定必需的 sysctl 引數,這些引數在重新啟動後仍然存在。
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables  = 1
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF

# 應用 sysctl 引數而無需重新啟動
sudo sysctl --system