Cluster Maintenance Flashcards
When you are conducting maintenance, how do you gracefully terminate a pod and recreate it on another node?
Drain the nodes
What is the command to drain a node?
k drain <node></node>
What is the command to allow a node to schedule pods after maintenance?
k uncordon <node></node>
What is the command to mark a node as unschedulable?
k cordon <node></node>
Can K8 components other than the kubectl be at a version higher than the kube-apiserver?
No
What is the first step of upgrading a cluster?
Upgrade the master cluster first. Worker nodes will not go down.
What are the kubeadm upgrade commands on a Debian based Linux node?
apt-get upgrade -y kubeadm=<version>
kubeadm upgrade apply <version></version></version>
What are the commands to upgrade the kubelet on a Debian based Linux node?
apt-get upgrade -y <kubelet_version>
systemctl restart kubelet</kubelet_version>
What is the command to backup all resources?
k get all –all-namespaces -oyaml > <filename>.yaml</filename>
What is the etcdctl command to create a snapshot?
etcdctl snapshot save <snapshot_name>.db</snapshot_name>
What is the process of restoring an ETCD snapshot?
service kube-apiserver stop
etcdctl restore <snapshot_name>.db
systemctl daemon-reload
service etcd restart
service kube-apiserver start</snapshot_name>
What is the etcdctl command to see the status of a snapshot?
etcdctl status <snapshot_name>.db</snapshot_name>
What is the command to get the clusters?
k config get-clusters
What command would you run to switch context to a different cluster named cluster1?
k config use-context cluster1
What command will show you the process for the kube-apiserver?
ps -ef | grep etcd