<p>In Azure pipeline I download kubernetes deployment.yml property file which contains following content.</p>

<pre><code>spec:
  imagePullSecrets:
  - name: some-secret
  containers:
  - name: container-name
    image: pathtoimage/data-processor:$(releaseVersion)
    imagePullPolicy: Always
    ports:
    - containerPort: 8088
    env:
</code></pre>

<p>My intention is to get the value from pipeline variable <code>$(releaseVersion)</code>. But it seems like <code>kubernetes</code> task doesn't allow this value to be accessed from pipeline variable. </p>

<p>I tried using inline configuration type and it works.That means If I copy same configuration as inline content to <code>kubernetes</code> task configuration, it works.</p>

<p>Is there anyway that I can make it work for the configuration from a file?</p>

<p>As I understand, you may want to replace the variable of deployment.yml file content while build executed.</p>

<p>You can use one task which name is <strong><a href="https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens&amp;targetId=8b5aa46a-618f-4eee-b902-48c215242e3e&amp;utm_source=vstsproduct&amp;utm_medium=ExtHubManageList" rel="noreferrer">Replace Tokens task</a></strong> (Note:The <strong>token</strong> under this task name is not same with PAToken). This is the task which support replace values of files in projects with environments variables when setting up VSTS Build/Release processes.</p>

<p>Install <strong>Replace Tokens</strong> from marketplace first, then add <strong>Replace Tokens task</strong> into your pipeline.</p>

<p>Configure the .yml file path in the Root directory. For me, my target file is under the Drop folder of my local. And then, point out which file you want to operate and replace.</p>

<p><a href="https://i.stack.imgur.com/pDoSy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pDoSy.png" alt="enter image description here"></a></p>

<p>For more argument configured, you can check this doc which I ever refer: <a href="https://github.com/qetza/vsts-replacetokens-task#readme" rel="noreferrer">https://github.com/qetza/vsts-replacetokens-task#readme</a></p>

<p><strong>Note</strong>: Please execute this task before Deploy to Kubernetes task, so that the change can be apply to the Kubernetes cluster. </p>

<p>Here also has another <a href="https://medium.com/@marcodesanctis2/a-build-and-release-pipeline-in-vsts-for-docker-and-azure-kubernetes-service-aks-41efc9a0c5c4" rel="noreferrer">sample blog</a> can for you refer.</p>
