How to set dynamic values with Kubernetes yaml file

前端 未结 13 2036
旧巷少年郎
旧巷少年郎 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 16:42

    yaml does not read values from another yaml file. As an alternative approach you could try this.

    kind: Pod
    metadata:
      creationTimestamp: null
      annotations:
        namespace: &namespaceId dev
        imageId: &imgageId nginx
        podName: &podName nginx-pod
        containerName: &containerName nginx-container
      name: *podName
      namespace: *namespaceId
    spec:
      containers:
      - image: *imgageId
        name: *containerName
        resources: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
    status: {}
    

提交回复
热议问题