1

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:

  • TILLER_NAMESPACE
  • HELM_TLS_ENABLE

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.

| improve this question | | | | |
0

Check this wrapper ?

It exports following variables based on the context

HELM_TLS_CA_CERT="${HELM_HOME}/tls/${K8S_CONTEXT}/ca.pem"
HELM_TLS_CERT="${HELM_HOME}/tls/${K8S_CONTEXT}/cert.pem"
HELM_TLS_KEY="${HELM_HOME}/tls/${K8S_CONTEXT}/key.pem"
HELM_TLS_ENABLE="true"
| improve this answer | | | | |

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.