如何使用Kubernetes Yaml文件设置动态值 [英] How to set dynamic values with Kubernetes yaml file

查看:600
本文介绍了如何使用Kubernetes Yaml文件设置动态值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,一个部署yaml文件:

For example, a deployment yaml file:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: guestbook
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: guestbook
      spec:
        container:
          - name: guestbook
            image: {{Here want to read value from config file outside}}

Kubernetes具有ConfigMap功能,但这也将键/值写入yaml文件.有没有办法设置环境变量的键?

There is a ConfigMap feature with Kubernetes, but that's also write the key/value to the yaml file. Is there a way to set the key to environment variables?

推荐答案

我认为无法通过Kubernetes中的变量或Config Map设置图像.但是您可以使用例如 Helm 来使您的部署更加灵活和可配置.

I don't think it is possible to set image through variable or Config Map in Kubernetes. But you can use for example Helm to make your deployments much more flexible and configurable.

这篇关于如何使用Kubernetes Yaml文件设置动态值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆