Kubernetes Cluster Maintenance

Kubernetes Cluster Maintenance

Kubernetes Cluster Upgrade

Upgrade master

Upgrading the control plane consist of the following steps:

  • Upgrade kubeadm on the Control Plane node
  • Drain the Control Plane node
  • Plan the upgrade (kubeadm upgrade plan)
  • Apply the upgrade (kubeadm upgrade apply)
  • Upgrade kubelet & kubectl on the control Plane node
  • Uncordon the Control Plane node

Determine which version to upgrade to

 apt update
 apt-cache madison kubeadm        

On the control plane node, run:


kubeadm upgrade plan        

Upgrading kubeadm tool


 apt-mark unhold kubeadm && \
 apt-get update && apt-get install -y kubeadm=1.26.3-00 && \
 apt-mark hold kubeadm        

Verify that the download works and has the expected version:

 kubeadm version        

Drain the control plane node:

 # replace <Node-Name> with the name of your control plane node
 $ kubectl drain <Node-Name> --ignore-daemonsets --delete-local-data        

On the control plane node, run:

 kubeadm upgrade plan
On the control plane node, run:
 kubeadm upgrade apply v1.26.3        

Un cordon the control plane node:

 $ kubectl uncordon <node name>
 $ kubectl uncordon master        

Upgrade kubelet and kubectl

 $ apt-mark unhold kubelet kubectl && \
 apt-get update && apt-get install -y kubelet=1.26.3-00 kubectl=1.26.3-00 && \
 apt-mark hold kubelet kubectl        

Restart the kubelet

$ systemctl daemon-reload
$ systemctl restart kubelet        

Check Version

$ kubectl get nodes        

The Master is Updated.

Upgrade Node

Upgrading the worker nodes consist of the following steps:

  • Drain the node
  • Upgrade kubeadm on the node
  • Upgrade the kubelet configuration (kubeadm upgrade node)
  • Upgrade kubelet & kubectl
  • Uncordon the node

  1. Check the Version of the worker node From?master machine

Kubectl get nodes        

  1. Upgrade Kubeadm perform this on?Worker Machine

apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.26.3-00 && \
apt-mark hold kubeadm        

Drain the Worker Node (perform this on master Machine)

 kubectl drain <node-to-drain> --ignore-daemonsets
 kubectl drain worker-02 --ignore-daemonsets        

Upgrade kubelet config on worker node (perform this on Worker Machine)

 kubeadm upgrade node        

Upgrade kubelet and kubectl (perform this on Worker Machine)

 apt-mark unhold kubelet kubectl && \
 apt-get update && apt-get install -y kubelet=1.18.8-00 kubectl=1.18.8-00 && \
 apt-mark hold kubelet kubectl        

Restart the kubelet

 systemctl daemon-reload
 systemctl restart kubelet        

Uncordon the node (perform this on the master Machine)

    kubectl uncordon worker-02        

Verify the status of the cluster

    kubectl get nodes        

Kubernetes Cluster upgraded successfully

Kubernetes backup & restore

The dynamic nature of Kubernetes environments presents challenges for traditional backup systems and techniques, with stricter requirements for Recovery Point Objective (RPO) and Recovery Time Objective (RTO). To address these challenges, three key features are recommended for enterprise backup solutions, including?disaster recovery, backup and restore, and local high availability. These features are considered essential best practices for Kubernetes backups.

Backup and Restore:

The backup process needs to be able to capture and save the entire Kubernetes app, including its?configuration, resources, and data, as a single unit for easy restoration. A proper Kubernetes backup system should be able to back up specific applications or groups of applications and the entire Kubernetes namespace. While it is similar to regular backup processes, Kubernetes?backup also requires specific features?like?retention,?scheduling, encryption, and tiering for?a more efficient backup and restore system

Viraj Deshpande

Associate Consultant at TCS

1 年

Anup Ghattikar please let me know where I can get 49 days DevOps course content

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了