|NO.Z.00100|——————————|^^ 升級 ^^|——|KuberNetes&二進位制升級.V11|-----------------------|kubernetes_Master|kubelet.v1.17.0——>v1.19.5|
阿新 • • 發佈:2022-03-29
[CloudNative:KuberNetes&二進位制升級.V11] [Applications.KuberNetes] [|DevOps|kubernetes|二進位制升級|kubernetes.v1.17.0——>v1.19.5|] [node元件|kubelet.v1.17.0——>v1.19.5|kube-proxy.v1.17.0——>v1.19.5|]
一、kubernetes升級kubelet.v1.17.0——>v1.19.5
### --- 下線kubernetes.node節點:k8s-master01 ~~~ # 下線node節點k8s-master01:把k8s-master01設定成不可排程狀態 ~~~ 注:--delete-local-data:將本地資料刪除掉 ~~~ 注:--ignore-daemonsets:將daemonsets忽略掉; 在建立daemonsets容器的時候會給pod打一個標籤,ischeduling的一個標籤 ~~~ 注:drain:也是給node節點的ischeduling標籤,master02有這個標籤,而--ignore-daemonsets容忍了這個標籤,它會一直在上面執行,變成死迴圈,所以把daemonset忽略掉 ~~~ 注:繫結節點,不用去漂移,直接重啟即可。 [root@k8s-master01 ~]# kubectl drain k8s-master01 --delete-local-data --force --ignore-daemonsets node/k8s-master01 cordoned
### --- 檢視節點的狀態 ~~~ 注:k8s-master02處於不可排程狀態 [root@k8s-master01 ~]# kubectl get node NAME STATUS ROLES AGE VERSION k8s-master01 Ready,SchedulingDisabled <none> 54d v1.17.0 k8s-master02 Ready <none> 54d v1.17.0 k8s-master03 Ready <none> 54d v1.17.0 k8s-node01 Ready <none> 54d v1.17.0 k8s-node02 Ready <none> 54d v1.17.0
### --- 檢視k8s-master02上是否執行容器
~~~ 注:k8s-master01節點的pod全部驅逐
[root@k8s-master01 ~]# kubectl get po --all-namespaces -owide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
default busybox 1/1 Running 33 54d 172.18.195.39 k8s-master03 <none> <none>
default demo-nginx-6bdcdcc585-f574t 2/2 Running 0 2m38s 172.18.195.43 k8s-master03 <none> <none>
default demo-nginx-6bdcdcc585-z9h5r 2/2 Running 2 3d 172.25.92.115 k8s-master02 <none> <none>
default nginx-78658dcf78-87gqv 2/2 Running 12 3d 172.18.195.40 k8s-master03 <none> <none>
default nginx-78658dcf78-v98kz 2/2 Running 26 3d2h 172.25.92.116 k8s-master02 <none> <none>
二、kubernetes.node節點升級kubelet:k8s-master01
### --- 檢視kubelet版本
[root@k8s-master01 ~]# /usr/local/bin/kubelet --version
Kubernetes v1.17.0
### --- 停止執行kubelet服務
[root@k8s-master01 ~]# systemctl stop kubelet
### --- 備份kubelet服務
[root@k8s-master01 ~]# which kubelet
/usr/local/bin/kubelet
[root@k8s-master01 ~]# mkdir /usr/local/bin/kubelet.bak
[root@k8s-master01 ~]# cp /usr/local/bin/kubelet /usr/local/bin/kubelet.bak/
### --- 升級kubelet服務
[root@k8s-master01 ~]# cp -rp upgrade/master/kubernetes/server/bin/kubelet /usr/local/bin/
cp: overwrite ‘/usr/local/bin/kubelet’? y
### --- 檢視kubelet版本
[root@k8s-node01 ~]# /usr/local/bin/kube-proxy --version
Kubernetes v1.19.5
### --- 啟動kubelet服務
[root@k8s-master01 ~]# systemctl daemon-reload
[root@k8s-master01 ~]# systemctl restart kubelet
三、將kubernetes.node節點k8s-master01加入到叢集中
### --- 上線node節點k8s-master01加入到叢集中
[root@k8s-master01 ~]# kubectl uncordon k8s-master01
node/k8s-master01 uncordoned
### --- 檢視kubernetes叢集kubelet版本
~~~ 注:k8s-master01版本的kubelet版本為v1.19.5,其它節點版本號沒有發生變化
[root@k8s-master01 ~]# kubectl get node
NAME STATUS ROLES AGE VERSION
k8s-master01 Ready <none> 54d v1.19.5
k8s-master02 Ready <none> 54d v1.17.0
k8s-master03 Ready <none> 54d v1.17.0
k8s-node01 Ready <none> 54d v1.17.0
k8s-node02 Ready <none> 54d v1.17.0
===============================END===============================
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart ——W.S.Landor
來自為知筆記(Wiz)