<p>I have my azure pipeline doing a kubernetes@1 task with my kubernetes config:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: tenant-service-deployment
  labels:
    app: tenant-service
spec:
  replicas: 3
  selector:
    matchLabels:
      app: tenant-service
  template:
    metadata:
      labels:
        app: tenant-service
    spec:
      containers:
        - name: tenant-service
          image: cronesharedwesteurope.azurecr.io/tenant-service:dev
          ports:
            - containerPort: 80   
      imagePullSecrets:
        - name: registrysecret

</code></pre>
<p>You can see that at the moment my image is hard coded in my yaml file (tenant-service:dev).</p>
<p>I want the user to tell me witha azure devops pipeline parameter which version he wants (e.g, dev / 1.0 / latest). But because the kubernetes is a yaml config file, I can't change it with a parameter, can I? Are there any tools to do exactly this?</p>

PassionateDeveloper
<p>@PassionateDeveloper for my case destination was GKE and we were using Azure DevOps for CI/CD. Requirements was to use Build.BuildID as image tag to uniquely distinguish all the image tags. Here is what I had used to fulfil the requirements.</p>
<pre><code>trigger:
- none

pool:
  name: {name of my self hosted agent pool}
  
variables:
  imageTag: '$(Build.BuildId)'
</code></pre>
<p>My kubernetes manifest looked like this.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
  labels:
    app: authenticator
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      nodeSelector:
        kubernetes.io/os: linux
      containers:
        - name: myapp
          image: gcr.io/myproject2/myapp:${imageTag} ---&gt; imageTag to be replaced with replaceToken task
          ports:
            - containerPort: 80
</code></pre>
<p>I have used the <a href="https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens" rel="nofollow noreferrer">https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens</a> to do the magic for me.</p>
<pre><code>- task: replacetokens@5
            inputs:
              rootDirectory: '$(Pipeline.Workspace)/s/MyProjectDirectoy/Manifests/'
              targetFiles: '**/*.*'
              encoding: 'auto'
              tokenPattern: 'custom'
              tokenPrefix: '${'
              tokenSuffix: '}'
              writeBOM: true
              verbosity: 'detailed'
              actionOnMissing: 'fail'
              keepToken: false
              actionOnNoFiles: 'continue'
              enableTransforms: false
              enableRecursion: false
              useLegacyPattern: false
              enableTelemetry: true
</code></pre>
<p>So my overall my deployment stage yaml file would look like this and it is working like a charm.</p>
<pre><code>- stage: Production
  displayName: Deploy stage
  dependsOn: Build


  jobs:
  - deployment: Production
    displayName: Production
    environment: $(envName)
    strategy:
      runOnce:
        deploy:
          steps:

          - task: replacetokens@5
            inputs:
              rootDirectory: '$(Pipeline.Workspace)/s/MyProjectDirectory/Manifests/'
              targetFiles: '**/*.*'
              encoding: 'auto'
              tokenPattern: 'custom'
              tokenPrefix: '${'
              tokenSuffix: '}'
              writeBOM: true
              verbosity: 'detailed'
              actionOnMissing: 'fail'
              keepToken: false
              actionOnNoFiles: 'continue'
              enableTransforms: false
              enableRecursion: false
              useLegacyPattern: false
              enableTelemetry: true


          - task: KubernetesManifest@0
            displayName: Deploy to Kubernetes cluster
            inputs:
              action: 'deploy'
              kubernetesServiceConnection: 'GKE'
              namespace: 'default'
              manifests: |
               $(Pipeline.Workspace)/s/MyProjectDirectory/Manifests/01-Deployment.yml
              imagePullSecrets: 'azure-pipelines-deploy-token-djmc7'


          - task: PostBuildCleanup@3
</code></pre>
