109. 如何配置 Rancher 部署的环境变量

张开发
2026/4/7 8:56:24 15 分钟阅读

分享文章

109. 如何配置 Rancher 部署的环境变量
Environment 环境Rancher v2.x 牧场主 v2.xProcedure 程序Environment variables can be configured on a Rancher Deployment for a variety of purposes. For example, to configure HTTP Proxy settings (HTTP_PROXY, HTTPS_PROXY and NO_PROXY), to enable collection of Rancher Performance Metrics (CATTLE_PROMETHEUS_METRICS), or to enable debug logs for the Rancher remotedialer (CATTLE_TUNNEL_DATA_DEBUG).环境变量可以在牧场主部署中配置用于多种目的。例如配置 HTTP 代理设置 HTTP_PROXY、HTTPS_PROXY 和 NO_PROXY、启用 Rancher 性能指标收集CATTLE_PROMETHEUS_METRICS或启用 Rancher 远程拨号器的调试日志CATTLE_TUNNEL_DATA_DEBUG。These environment variables can be configured temporarily via kubectl, which may be desirable in a troubleshooting scenario, or persistently via Helm chart values.这些环境变量可以通过 kubectl 临时配置这在故障排除场景中可能更为理想或者通过 Helm 图表值持续配置。Using kubectl: 使用 kubectlA Rancher environment variable can be set quickly using kubectl, per the following example:Rancher 环境变量可以通过 kubectl 快速设置示例如下kubectl set env -n cattle-system deployment/rancher CATTLE_PROMETHEUS_METRICStrueWhen setting a variable with kubectl, it will be overwritten at the next Rancher upgrade with Helm.用 kubectl 设置变量时下一次用 Helm 升级牧场主时会被覆盖。Using Helm: 使用舵手If you need to set an environment variable persistently, add these to the Rancher Helm chart values via the extraEnv list, as documented here.如果你需要持续设置环境变量可以通过 extraEnv 列表将这些变量添加到 Rancher Helm 图表的值中正如这里文档所述 。You can check the current environment variables in a running Rancher Pod with the following command:您可以使用以下命令检查运行中的牧场主舱当前环境变量kubectl exec --namespace cattle-system RANCHER-POD -- env访问Rancher-K8S解决方案博主企业合作伙伴 https://blog.csdn.net/lidw2009

更多文章