k8s升级步骤记录(markdown测试)

common prepration

new version binaries

  • kubelet
  • kube-proxy
  • kubectl
  • kube-apiserver
  • kube-controller-manager
  • kube-scheduler

1. upgrade nodes

migrate running pods to other nodes

kubectl patch nodes $HOSTNAME -p '{"spec": {"unschedulable": true}}'
kubectl get po --all-namespaces | awk '{print $1}' | grep -v NAME | xargs kubectl delete po

stop docker containes

docker stop `docker images -q`

clean residues

rm -rf /var/lib/docker/containers/*

clean docker images

docker rmi -f `docker images -q`

stop kubelet, kubeproxy, docker services

for i in kubelet kube-proxy docker flanneld; do systemctl stop $i; done

upgrade docker

yum upgrade -y docker

backup old kubelet and kube-proxy

mv /usr/bin/kubelet  /usr/bin/kubelet.bk
mv /usr/bin/kube-proxy  /usr/bin/kube-proxy.bk

overwrite old kubelet and kube-proxy with new version binaries

for i in kubelet kube-proxy kubectl; do cp -f $i /usr/bin/; done

start docker, kubelet, kube-proxy

for i in flanneld  docker kuke-proxy kubelet; do systemctl start $i; done

pull pause and docker tag

docker pull 

make node schedulable

kubectl patch nodes $HOSTNAME -p '{"spec": {"unschedulable": false}}'

2. upgrade master

migrate running pods to other nodes if exists

clean docker images

stop [etcd] kube-apiserver kubelet kube-proxy kube-controller-manager kube-scheduler docker flanneld

for i in flanneld kube-apiserver kubelet kube-proxy kube-controller-manager kube-scheduler docker; do systemctl stop $i; done

clean residues

upgrade docker

overwrite old kubelet and kube-proxy with new version binaries

for i in kubelet kube-proxy kubectl kube-apiserver kube-controller-manager kube-scheduler; do cp -f $i /usr/bin/; done

start docker, kubernets

for i in etcd flanneld kube-apiserver kubelet kube-proxy kube-controller-manager kube-scheduler docker; do systemctl start $i; done

make node schedulable

发表评论

电子邮件地址不会被公开。 必填项已用*标注