Skip to main content

Azure Kubernetes Service (AKS) Cluster

Creates an Azure Kubernetes Service (AKS) cluster using F#

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set classic-azure-fs-aks
cd pulumi-examples/classic-azure-fs-aks

Stands up an Azure Kubernetes Service (AKS) cluster.

Prerequisite#

  1. Install Pulumi
  2. Install .NET Core 3.1+
  3. Install Azure CLI

Configure the environment:

Terminal window
pulumi config set azure:location westeurope
pulumi config set azure:subscriptionId <YOUR_SUBSCRIPTION_ID>
az login

Deploying the App (short version)#

To make it easier to try out you can use the available Makefile, like:

Terminal window
make deploy

This will build the project and run pulumi up -y. If you haven’t created a stack you will be prompted to do so.

When the deploy is finished you can export the kubernetes config by running

Terminal window
make exportconfig

With the config exported you can now test to access the kubernetes cluster

Terminal window
KUBECONFIG=./kubeconfig.yaml kubectl get nodes

If you want to cleanup when you are done you can run

Terminal window
make destroy
make rmstack

To list all make targets run

Terminal window
make help

The Makefile also works as documentation on what commands you need to run to deploy the application.

Deploying the app (native version)#

If you don’t have make installed you will have to run the “native” commands. To deploy you run

Terminal window
pulumi up --yes

This will prompt you to create a stack if you haven’t done so already. When the deploy is ready you can export the kubernetes config with

Terminal window
pulumi stack output kubeconfig --show-secrets > kubeconfig.yaml

and then test the deployment with

Terminal window
KUBECONFIG=./kubeconfig.yaml kubectl get nodes

If you want to cleanup the cloud resources when you are done you can run

Terminal window
pulumi destroy -y
pulumi stack rm -y

Related

The infrastructure as code platform for any cloud.