If you’re working with Kubernetes then there’s a pretty good chance that you’ve been working with kubectl
!
There’s also a pretty good chance that you end up working with more than one cluster context. So, how do you manage multiple contexts?
KUBECONFIG
One way that you might have encountered is obtaining a kubeconfig
file that contains the details of how to connect to a cluster. kubectl
allows you to pass a --kubeconfig
option to commands to specify which kubeconfig
should be used to connect to a cluster to execute the command. E.g. kubectl get pods --kubeconfig=/path/to/kubeconfig
.