![]() Then you can change context using kubectl config use-context. * scale-test scale-test clusterUser_scale-test_scale-test loadtest ![]() At this point, you might be wondering how to switch between the multiple contexts when you have multiple files (or indeed if you have multiple contexts defined within a single file!).įirstly, you can find out what contexts are currently in scope by running kubectl config get-contexts:Īks-dev aks-dev clusterUser_aks-dev_aks-dev default export KUBECONFIG=/path/to/kubeconfig:/path/to/another/kubeconfig. Multiple KUBECONFIGs, multiple contextsĮven better, you can specify multiple contexts in the KUBECONFIG environment variable, e.g. export KUBECONFIG=/path/to/kubeconfig (bash) or $env:KUBECONFIG=c:\path\to\kubeconfig (PowerShell). Repeatedly passing the -kubeconfig option can get tedious, so an alternative is to set the KUBECONFIG environment variable and kubectl will use that, e.g. ![]() kubectl get pods -kubeconfig=/path/to/kubeconfig. 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. One way that you might have encountered is obtaining a kubeconfig file that contains the details of how to connect to a cluster. So, how do you manage multiple contexts? KUBECONFIG There’s also a pretty good chance that you end up working with more than one cluster context. If you’re working with Kubernetes then there’s a pretty good chance that you’ve been working with kubectl!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |