Skip to content
Latchkey

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@1 step with action: deploy.
  • List your manifests and the containers image 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

  • containers only substitutes images whose name (minus tag) matches one already in the manifest.
  • Add an imagePullSecret input if the cluster cannot pull from a private registry.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →