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

Connecting services in helm

· 52CE 我爱测

The standard practice in helm charts is to use {{ template "<chartname>.fullname" . }} for the service name, where the <chartname>.fullname template expands effectively to .Release.Name-.Chart.name . The later can be overridden b…

问题原文

原帖链接 · Jan Hudec · CC BY-SA 3.0

The standard practice in helm charts is to use {{ template "<chartname>.fullname" . }} for the service name, where the <chartname>.fullname template expands effectively to .Release.Name-.Chart.name. The later can be overridden by .Values.nameOverride, but the former, or the full value, can't. And the former is either administrator-specified or random.

So how do I tell the service I am creating chart for where to connect to its dependencies? The .Release.Name prefix infects both DNS and the environment variables, so I can't use either as is.

For example if I set dependency to stable/mariadb, it will create service like nutty-narwhal-mariadb and provide environment variables NUTTY_NARWHAL_MARIADB_SERVICE_HOST=10.108.77.204 and NUTTY_NARWHAL_MARIADB_SERVICE_PORT=3306. But that's not helpful, because the service I am creating does not know what the prefix is.

Note that the template generated by current helm create does include .Values.fullnameOverride, but the existing charts in main repository like stable/mariadb don't have it, so I can't simply set mariadb.fullnameOverride in my values.yaml.

已采纳解答

原帖链接 · Radek 'Goblin' Pieczonka · CC BY-SA 3.0

Normally your dependencies would be aggregated under the same "umbrella" chart resulting in a single .Release.Name for all of them, meaning that you will be able to point to them in your chart using stuff like .Release.Name-<subchart>. If for some reason you don't want to do it like this and you deploy your dependencies before you deploy your main chart, then you should be able to point them at the location of dependencies by their provisioned name, as you should get it when you installed them.

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

资料来源与适用范围

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

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

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