如何将 shell 命令从 Helm Values.yaml 文件传递到Deployment.yaml

问题描述 投票:0回答:1

我得到了 Dockerfile 来为 python 应用程序构建镜像。

我得到了运行uwsgi服务器的entrypoint.sh脚本。 然后有一个部署 yaml 来运行这个镜像。 我为此创建了 helm 图表,因此在部署.yaml 中我得到了

spec: containers: command: {{ .Values.api.command_to_run }}

在values.yaml中我得到:

command_to_run: "[/bin/sh -c /app/entrypoint-prod.sh]"

如何从values.yaml文件传递此类

python kubernetes kubernetes-helm
1个回答
0
投票

如果 Helm 模板中有类似的内容:

...
spec:
  containers:
  - name: ...
    image: ...
    command: 
      - {{ .Values.api.command_to_run }}

那么您的

.Values
文件应包含以下值:

api:
  command_to_run: "[/bin/sh -c /app/entrypoint-prod.sh]"
© www.soinside.com 2019 - 2024. All rights reserved.