Can someone pls clarify how to jump between clusters in k8s and how to get the ip/hostname of master nodes of the clusters to login to a particular cluster. Is it done by setting the “config context”.
The instructions in the image says that, the commands are provided for each question to jump to the correct cluster. can anyone please share the experience.
You can do kubectl get nodes to see the joined master and worker nodes list.
If you are talking about exam perspective, they will provide you proper instructions with the each questions.
Suppose you have 1 master node and 2 worker node ( worker-one, worker-two)
kubectl get nodes # List the nodes ssh worker-two
To jump between the clusters. You will get the context.
To see the list of the contexts.
kubectl config get-contexts
To switch into the other contexts.
kubectl config use-context <context-name>
kubectl config use-context k8s-context
To see the current-context
kubectl config current-context
Thanks for the detailed information.
I had a notion that contexts may not be used to shuffle between clusters, it’s used only within a cluster to jump b/w different namespaces and so on.
You can read from the official docs of k8s.