Step-by-Step Guide to Upgrading Kubernetes Nodes to v1.15.12
This tutorial walks you through downloading the latest Kubernetes packages, preparing master and node services, adjusting nginx proxy settings, cordoning and draining nodes, replacing binaries and certificates, restarting services, and verifying the upgrade across a two‑node cluster.
1. Download Software Packages
Download the latest Kubernetes packages from GitHub (e.g., https://github.com/...).
2. Upgrade Description
Upgrade includes master node and worker nodes, targeting version v1.15.12.
Master services: apiserver, controller‑manager, kube‑scheduler.
Node services: kubelet and kube‑proxy.
Because apiserver is behind nginx, comment out the upgraded node in the nginx upstream to avoid access issues.
Master and node run on the same server, so they are upgraded together.
3. Determine Node Upgrade Order
Check node information: kubectl get node Check pod distribution and choose the node with fewer pods for migration: kubectl get pod -o wide -n kube-system Since the distribution is similar, select the node on 10.4.7.21 for upgrade.
4. Modify nginx Proxy Configuration
Edit the nginx configuration on both 10.4.7.21 and 10.4.7.22, commenting out the apiserver entry for the node being upgraded (example for 10.4.7.21):
vim /etc/nginx/nginx.conf
upstream kube-apiserver {
# server 10.4.7.21:6443 max_fails=3 fail_timeout=30s;
server 10.4.7.22:6443 max_fails=3 fail_timeout=30s;
}
nginx -t
nginx -s reload5. Delete First Node
Cordon the node to make it unschedulable: kubectl cordon hdss7-21.host.com Drain the node, evicting pods while ignoring daemonsets and forcing deletion of local data:
kubectl drain hdss7-21.host.com --delete-local-data --ignore-daemonsets --forceExplanation of flags: --delete-local-data removes emptyDir data, --ignore-daemonsets prevents daemonset pods from being recreated, and --force also removes pods not managed by a controller.
Verify pod distribution after draining: kubectl get pod -o wide -n kube-system Delete the node from the cluster:
kubectl delete node hdss7-21.host.com6. Upgrade First Node
Extract the new version and replace binaries:
cd /opt/src/
tar -zxvf kubernetes-server-linux-amd64-v1.15.12.tar.gz
mv kubernetes /opt/kubernetes-v1.15.12
cd /opt/kubernetes-v1.15.12/
rm -f kubernetes-src.tar.gz
cd server/bin/
rm -f *.tar *_tag
# list binaries to confirm
llCopy certificates:
cp /opt/kubernetes/server/bin/certs/* certs/
ls certs/Copy startup scripts:
cp /opt/kubernetes/server/bin/*.sh .
lsCopy configuration files:
cp /opt/kubernetes/conf/* /opt/kubernetes-v1.15.12/conf/
ls /opt/kubernetes-v1.15.12/conf/Recreate the symlink for the Kubernetes directory:
cd /opt/
rm -rf kubernetes
ln -s /opt/kubernetes-v1.15.12 /opt/kubernetes
ll7. Restart Node Services
Check service status with supervisorctl: supervisorctl status Restart kubelet and kube‑proxy on the upgraded node:
supervisorctl restart kube-kubelet-7-21
supervisorctl restart kube-proxy-7-21Verify the node version:
kubectl get node8. Restart Master Services
supervisorctl restart kube-apiserver-7-21
supervisorctl restart kube-controller-manager-7-21
supervisorctl restart kube-scheduler-7-21Monitor logs to ensure the services start without errors.
9. Upgrade Second Node
Repeat the same procedure on the remaining node (10.4.7.22). After completing the steps, verify service status and node versions:
supervisorctl status
kubectl get node10. Restore nginx Proxy
Re‑edit the nginx upstream to include both servers:
vim /etc/nginx/nginx.conf
upstream kube-apiserver {
server 10.4.7.21:6443 max_fails=3 fail_timeout=30s;
server 10.4.7.22:6443 max_fails=3 fail_timeout=30s;
}
nginx -t
nginx -s reload11. Test Platform
Open the Kubernetes dashboard to confirm all components are healthy (screenshots omitted for brevity).
12. Reallocate Pods
Delete a pod from the overloaded node (e.g., a coredns pod). The scheduler will recreate it on the less loaded node:
kubectl delete pod coredns-64f49f5655-smzzz -n kube-systemObserve the pod restarting on the other node.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
