How to set dynamic values with Kubernetes yaml file

前端 未结 13 2043
旧巷少年郎
旧巷少年郎 2020-12-04 16:22

For example, a deployment yaml file:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: guestbook
spec:
  replicas: 2
  template:
    metadata         


        
13条回答
  •  天命终不由人
    2020-12-04 17:04

    You can also use envsubst when deploying.

    e.g.

    cat $app/deployment.yaml | envsubst | kubectl apply ...
    

    It will replace all variables in the file with their values. We are successfully using this approach on our CI when deploying to multiple environments, also to inject the CI_TAG etc into the deployments.

提交回复
热议问题