Kubernetes configuration with yaml anchors
YAML anchors are supported, but only for the same YAML file. You can't create the anchor (&amp;) on a deployment file and reference (*) the value on another one.
If you want to share ENVs values across multiple Deployments, you can create a ConfigMap with the ENVs and use the envFrom spec. Example:
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-configmap
data:
  FIRST_ENV: my-value
  SECOND_ENV: another-value
---  
apiVersion: apps/v1
kind: Deployment
metadata:
  name: beat
spec:
  selector:
    matchLabels:
      app: beat
  template:
    metadata:
      labels:
        app: beat
    spec:
      containers:
      - name: beat
        image: myimage
        command: [&quot;celery&quot;, &quot;-A&quot;, &quot;wsgi.celery&quot;, &quot;beat&quot;]
        envFrom:
        - configMapRef:
            name: my-configmap
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: flower
spec:
  selector:
    matchLabels:
      app: flower
  template:
    metadata:
      labels:
        app: flower
    spec:
      containers:
      - name: flower
        image: myimage
        command: [&quot;celery&quot;, &quot;flower&quot;, &quot;-A&quot;, &quot;wsgi.celery&quot;]
        envFrom:
        - configMapRef:
            name: my-configmap