How to Deploy to AKS in Azure Pipelines
The KubernetesManifest task applies your manifests to AKS and substitutes the freshly built image tag.
Create a Kubernetes service connection to your AKS cluster, then use the KubernetesManifest deploy action with containers to set the image.
Deploy manifests with image substitution
The task applies the manifests and replaces the image reference with the tag you built.
azure-pipelines.yml
- task: KubernetesManifest@1
inputs:
action: deploy
connectionType: kubernetesServiceConnection
kubernetesServiceConnection: aks-prod
namespace: web
manifests: |
manifests/deployment.yml
manifests/service.yml
containers: myregistry.azurecr.io/web:$(Build.BuildId)Notes
- The Kubernetes service connection holds cluster credentials so the task does not need a raw kubeconfig.
- containers overrides the image in the manifest with the tag from this build.
- Use a deployment job with an environment to get AKS resource visibility and approvals.
Related guides
How to Use a Deployment Job with an Environment in Azure PipelinesUse an Azure Pipelines deployment job targeting a named environment to get deployment history, approvals, and…
How to Gate with Manual Approval in Azure PipelinesRequire a human approval before an Azure Pipelines deploy by adding an approval check to the target environme…