Upgrade a single node cluster

Kubernetes version: v1.18.19
Cloud being used: bare-metal
Installation method: kubeadm
Host OS: CentOS7
CNI and version: calico/cni:v3.17.0
CRI and version: docker 18.09.9

I upgrade my k8s cluster from v1.18.19 to v1.19.16 refer to this guide: Upgrading kubeadm clusters | Kubernetes

What I have done is here:

yum list --showduplicates kubeadm --disableexcludes=kubernetes
yum install -y kubeadm-1.19.16-0 --disableexcludes=kubernetes
kubeadm upgrade plan
kubeadm upgrade apply v1.19.16
yum install -y kubelet-1.19.16-0 kubectl-1.19.16-0 --disableexcludes=kubernetes
systemctl daemon-reload
systemctl restart kubelet

When I restart kubelet, the cluster turn down, and I find the message:

Error: failed to run Kubelet: unable to determine runtime API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix: missing address

It seems I should change the Container Runtime from dockershim to containerd, but I am not sure.

Then I have a try to change the runtime refer to this guide: Changing the Container Runtime on a Node from Docker Engine to containerd | Kubernetes


  • stop kubelet
  • configure and start containerd
  • configure kubelet to use containerd
    • update the file /var/lib/kubelet/kubeadm-flags.env
    • kubectl edit no <node-name> to change the value of kubeadm.alpha.kubernetes.io/cri-socket from /var/run/dockershim.sock to /var/run/containerd/containerd.sock

The problem is that the kubelet is already stopped, and the apiserver pod is also stopped, I can’t run kubectl edit no <node-name> to update the node infomation.