Hi All, I have a question on the "kubectl config use-context *** " with respect . . .

Sahasransu Pani:
Hi All,

I have a question on the "kubectl config use-context *** " with respect to upgrade:

Say in the exam you are in worker node and they asked you to upgrade to the master node to V1.26.
you will have to ssh to master node and there you will first execute the command "kubectl config use-context *** "
and start the upgrade process ?


Mohamed Ayman:
Yes exactly and It’s important to check the official documentation for upgrading specific version.

Sahasransu Pani:
In the K8 doc page(Upgrading kubeadm clusters) it has not maintained when to use context ("kubectl config use-context *** ")

Mohamed Ayman:
The kubectl config use-context command switches context in kubeconfig file, it is not used for upgrading a Kubernetes cluster. Upgrading a cluster requires different commands with ssh to master node first and context switching is not necessary.

Hi @Sahasransu Pani since you have many cluster in k8s exam, each question you may have to work on different clusters. So switching from one cluster to another you need to use kubectl config use-context *** fyr:https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/#define-clusters-users-and-contexts

Alistair Mackay:
In the exam they give you the use context command as part of the question. You copy it and paste to the terminal at the start of each question.

Sahasransu Pani:
Thank you @unnivkn and @Alistair Mackay