Azure Kubernetes Service (AKS) Cluster using the native Azure Provider
A C# Pulumi program to provision an Azure Kubernetes Service (AKS) cluster
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set azure-cs-akscd pulumi-examples/azure-cs-aksThis example deploys an AKS cluster, creates an Azure Active AD application, creates a Service Principal and sets credentials to manage access to the cluster.
Deploying the App#
To deploy your infrastructure, follow the below steps.
Prerequisites#
Steps#
After cloning this repo, from this working directory, run these commands:
-
Create a new stack, which is an isolated deployment target for this example:
Terminal window pulumi stack init dev -
Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
$ az login -
Set the azure location in which to run the test:
$ pulumi config set azure-native:location westus2 -
Stand up the cluster by invoking pulumi
Terminal window pulumi up -
After 3-4 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:
Terminal window pulumi stack output kubeconfig --show-secrets > kubeconfig.yamlOnce you have this file in hand, you can interact with your new cluster as usual via
kubectl:Terminal window KUBECONFIG=./kubeconfig.yaml kubectl get nodes -
From 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:
Terminal window pulumi destroy --yespulumi stack rm --yes