If I am using kubectx
and switch kube config contexts into another cluster e.g. "Production" and run a helm uninstall
, how does Helm know which cluster I am referring to?
If I run the helm list
command is it only referring to what's installed on my local machine and not per Kubernetes cluster?
Helm will default to using whatever your current Kubernetes context is, as specified in the $HOME/.kube/config
file.
There is standard support in the Kubernetes API libraries to read data out of this file (or an alternative specified by a $KUBECONFIG
environment variable). If you're writing Go, see the documentation for the k8s.io/client-go/tools/clientcmd
package. While kubectx
does a bunch of things, its core uses that API to do essentially the same thing as running kubectl config use-context ...
.
If you want Helm to use a non-default context, there is a global option to specify it:
kubectx production
helm list
kubectx development
helm --kube-context production list