Azure Kubernetes Service (AKS) Cluster
Stands up an Azure Kubernetes Service (AKS) cluster and deploys an application to it.
Deploying the App
To deploy your infrastructure, follow the below steps.
Prerequisites
Steps
Create a new stack:
$ pulumi stack init devLogin to Azure CLI (you will be prompted to do this during deployment if you forget this step):
$ az loginSet the azure location in which to run the test:
$ pulumi config set azure:location westusStand up the AKS cluster:
Note: Due to an issue in Azure Terraform Provider, the creation of an Azure Service Principal, which is needed to create the Kubernetes cluster, is delayed and may not be available when the cluster is created. If you get a “Service Principal not found” error, as a work around, you should be able to run
pulumi upagain, at which time the Service Principal replication should have been completed. See this issue and this doc for further details.$ pulumi upAfter 10-15 minutes, your cluster will be ready, and the kubeconfig YAML you’ll use to connect to the cluster will be available as an output. You can save this kubeconfig to a file like so:
$ pulumi stack output kubeconfig > kubeconfig.yamlOnce you have this file in hand, you can interact with your new cluster as usual via
kubectl:$ KUBECONFIG=./kubeconfig.yaml kubectl get nodesYou can check that the application is loadbalanced across all of the pods:
$ for i in {0..10}; do curl $(pulumi stack output url); doneFrom there, feel free to experiment. Simply making edits and running
pulumi upwill incrementally update your stack.Once you’ve finished experimenting, tear down your stack’s resources by destroying and removing it:
$ pulumi destroy --yes $ pulumi stack rm --yes