Professional Documents
Culture Documents
Section 5: Cluster Maintenance
Section 5: Cluster Maintenance
OS Upgrades
nodes.
● Some of the commands used to temporarily take nodes down for
maintenance are:-
○ k drain <node-name>
◆ k drain --ignore-daemonsets <node-name> : incase there
– k cordon <node-name>
– Unlike drain it does not recreate pods on other nodes, it
simply makes sure that no new pods can be scheduled on
the node.
◆ This means no pods can be scheduled on the node unless you
version.0
◆ v1.25.0
◆ v1.26.0 etc
◆ There are also alpha and beta releases :
◆ Alpha release : consist of bug fixes and improvements. In
stable version.
○ If the current stable version is v1.26.0 then K8s only provides
v1.minor.0
◆ systemctl restart kubelet
◆ k uncordon <worker-node1>
services.yaml
◆ This is ideal in a managed k8s environment such as in a cloud
● You can backup the k8s cluster info in ETCD database with
command :-
○ First run, export ETCDCTL_API=3 : set a enviromnent variable so
etcdctl utility.
◆ After running this command, a snapshot file is created in the
current directory.
◆ You can also save it somewhere else by providing full path.
○ To view the status of the captured snapshot :-
◆ snapshot status <snapshot-name>.db
○ To restore the snapshot :-
name>.db --data-dir=/var/lib/etcd-from-backup
◆ Upon running this command a new data directory is
created.
◆ This initializes a new cluster configuration and configures
members of the ETCD cluster as new members to a new
cluster.
– This is to prevent a new member from accidentally
joining cluster.
backup.
etcdctl --endpoints=https://[127.0.0.1]:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \