大网数据广告活动
服务器运维问答

Switch helm config based on kubectl context

· 52CE 我爱测

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-conte…

问题原文

原帖链接 · Remco Haszing · CC BY-SA 4.0

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.

已采纳解答

原帖链接 · Dawid Kruk · CC BY-SA 4.0

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:

  • TILLER_NAMESPACE
  • HELM_TLS_ENABLE

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:

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-06-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。