I’m using Helm for managing apps running in my Kubernetes cluster. I’m managing multiple clusters for different environments. kubectl supports this out of the box, e.g.:

kubectl config set-context staging
kubectl config set-context production

To each cluster belongs a specific Helm configurarion.

2 environment variables:


And in case HELM_TLS_ENABLE is true, also a PEM certificate and key.

Currently when I switch context, I need to change the Helm related variables manually. Is there a way to automate this? I imagined maybe a hook that’s called when the kubectl context is changed, but I couldn’t really find a way.

A ZSH specific option is also acceptable, although a shell agnostic method is preferred.

  • Hello, have you managed to find suitable solution for your use case by any chance or are you still looking for one? – Dawid Kruk Feb 22 at 16:35
  • 1
    I have moved on to Helm 3, which no longer uses Tiller. This has made the issue irrelevant for me. – Remco Haszing Feb 22 at 16:38
  • As you are no longer affected by this issue, I kindly ask you to provide an answer for the visibility of other community members. A side note: Helm v2 was deprecated on 13th of November 2020. – Dawid Kruk Mar 16 at 18:27

Check this wrapper ?

It exports following variables based on the context


Posting this answer as a community wiki to point to the comments made under the question and to add additional information.

Feel free to expand.

This issue is now to be considered irrelevant. The question was specific on the following environment variables:


Focusing specifically on tiller:

A companion server component, tiller , that runs on your Kubernetes cluster, listens for commands from helm , and handles the configuration and deployment of software releases on the cluster. The Helm packaging format, called charts.

-- Digitalocean.com: Community: Tutorials: An introduction to helm the package manager for Kubernetes

Helm v2 which was using tiller is now deprecated. Helm v3 does not use tiller anymore.

Citing the official documentation on support skew:

After November 13, 2020, you will see these changes:

  • No further Helm v2 releases (even for security patches)
  • No further updates to Helm v2 documentation, which will remain available for the present time but may be discontinued
  • Existing and new issues/PRs that are v2-specific will be closed Transitioning Helm release and chart hosting ownership to CNCF

Additional resources:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.