<p>I tried to set variables in Azure Pipelines' Release which can be used Command Task in Release to replace variables' values to Docker Kubernetes' .yaml file.</p>
<p>It works fine for me but I need to prepare several Command Tasks to replace variables one by one.</p>
<p>For example, I set variable TESTING1_(value:Test1), TESTING2_(value:Test2) and TESTING3_(value:Test3) in Pipelines' Release. Then I only used Command Task to replace TESTING1_ to $(TESTING1_) in Docker Kubernetes' .yaml file. Below is original environment setting in .yaml file:</p>
<pre><code>spec:
  containers:
  - name: devops
      env:
      - name: TESTING1
        value: TESTING1_
      - name: TESTING2
        value: $(TESTING2_)
</code></pre>
<p>After ran Pipelines' Release, print out results in NodeJS were:</p>
<blockquote>
<p>console.log(process.env.TESTING1); --&gt; Test1</p>
<p>console.log(process.env.TESTING2); --&gt; $(TESTING2_)</p>
<p>console.log(process.env.TESTING3); --&gt; undefined</p>
</blockquote>

DaiKeung
<p>i think you should be use config maps for that (maybe update values in config maps). you shouldn't be updating containers directly. this gives you flexibility and management.  example:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: dapi-test-pod
spec:
  containers:
    - name: test-container
      image: k8s.gcr.io/busybox
      command: [ "/bin/sh", "-c", "env" ]
      env:
        - name: SPECIAL_LEVEL_KEY
          valueFrom:
            configMapKeyRef:
              name: special-config
              key: special.how
</code></pre>

<p>and then if some value changes you update the config map and all the pods that reference this config map get new value.</p>

<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#define-container-environment-variables-using-configmap-data" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#define-container-environment-variables-using-configmap-data</a></p>
