How to Deploy to AKS With KubernetesManifest in Azure Pipelines
KubernetesManifest@1 applies your manifests to an AKS cluster and waits for the rollout to become healthy.
Create a Kubernetes service connection to your AKS cluster, then run KubernetesManifest@1 with action: deploy, your manifest files, and the image to substitute.
Steps
- Create a Kubernetes service connection (Azure subscription or kubeconfig).
- Add a
KubernetesManifest@1step withaction: deploy. - List your
manifestsand thecontainersimage to roll out. - The task waits for the Deployment to become ready.
azure-pipelines.yml
azure-pipelines.yml
pool:
vmImage: ubuntu-latest
steps:
- task: KubernetesManifest@1
inputs:
action: deploy
connectionType: kubernetesServiceConnection
kubernetesServiceConnection: 'aks-prod'
namespace: 'default'
manifests: |
k8s/deployment.yaml
k8s/service.yaml
containers: 'myacr.azurecr.io/web:$(Build.BuildId)'Gotchas
containersonly substitutes images whose name (minus tag) matches one already in the manifest.- Add an
imagePullSecretinput if the cluster cannot pull from a private registry.
Related guides
How to Deploy With Helm Using HelmDeploy in Azure PipelinesInstall or upgrade a Helm chart to a Kubernetes cluster from Azure Pipelines with the HelmDeploy@0 task, sett…
How to Deploy Blue-Green With the Canary Strategy in Azure PipelinesRoll out a deployment gradually in Azure Pipelines with the canary strategy of a deployment job, using preDep…