kubernetes 如何在Helm中读取模板文件?

yc0p9oo0  于 2023-03-22  发布在  Kubernetes
关注(0)|答案(1)|浏览(201)
apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx
  namespace: nginx-ingress
data:
  nginx.ingress.tmpl: {{ (tpl (.Files.Get "nginx.ingress.tmpl") . | quote ) }}

如何在helm中读取模板文件?
我收到错误
at〈tpl(.Files.Get“nginx.ingress.tmpl”).〉:调用tpl时出错:在执行“# configuration for”的tpl函数时出错

svujldwt

svujldwt1#

试试这个:

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx
  namespace: nginx-ingress
data:
  {{- $files := .Files }}
  {{- range tuple "nginx.ingress.tmpl" }}
  {{ . }}: |-
        {{ $files.Get . }}
  {{- end }}

https://helm.sh/docs/chart_template_guide/accessing_files/

相关问题