Kubernetes Cluster on Azure
The Azure Kubernetes Cluster template scaffolds a Pulumi project that provisions a managed Azure Kubernetes Service (AKS) cluster inside a new Azure Virtual Network with three subnets. Worker nodes are deployed with private IP addresses for improved security and spread across multiple availability zones for resilience.


Using this template#
To use this template to deploy your own Kubernetes cluster, make sure you’ve installed Pulumi and configured your Azure credentials, then create a new project using the template in the language of your choice:
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-azure-typescriptAlternatively, you can create and configure a new project with this template (kubernetes-azure-typescript) in Pulumi Cloud.
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-azure-pythonAlternatively, you can create and configure a new project with this template (kubernetes-azure-python) in Pulumi Cloud.
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-azure-goAlternatively, you can create and configure a new project with this template (kubernetes-azure-go) in Pulumi Cloud.
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-azure-csharpAlternatively, you can create and configure a new project with this template (kubernetes-azure-csharp) in Pulumi Cloud.
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-azure-yamlAlternatively, you can create and configure a new project with this template (kubernetes-azure-yaml) in Pulumi Cloud.
mkdir my-k8s-cluster && cd my-k8s-clusterpulumi new kubernetes-azure-hclAlternatively, you can create and configure a new project with this template (kubernetes-azure-hcl) in Pulumi Cloud.
Follow the prompts to complete the new-project wizard. When it’s done, you’ll have a complete Pulumi project that’s ready to deploy and configured with the most common settings. Feel free to inspect the code in index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yaml for a closer look.
Deploying the project#
You must supply two values to deploy the cluster. You can input both through the new-project wizard:
- mgmtGroupId
The object ID of an existing Azure AD group that will serve as the cluster administrator.
- sshPubKey
The contents of the public key used for SSH access to the cluster nodes.
Once the project is created, you can deploy it with pulumi up:
You must supply two values to deploy the cluster. You can input both through the new-project wizard:
- mgmtGroupId
The object ID of an existing Azure AD group that will serve as the cluster administrator.
- sshPubKey
The contents of the public key used for SSH access to the cluster nodes.
Once the project is created, you can deploy it with pulumi up:
You must supply two values to deploy the cluster. You can input both through the new-project wizard:
- mgmtGroupId
The object ID of an existing Azure AD group that will serve as the cluster administrator.
- sshPubKey
The contents of the public key used for SSH access to the cluster nodes.
Once the project is created, you can deploy it with pulumi up:
You must supply two values to deploy the cluster. You can input both through the new-project wizard:
- mgmtGroupId
The object ID of an existing Azure AD group that will serve as the cluster administrator.
- sshPubKey
The contents of the public key used for SSH access to the cluster nodes.
Once the project is created, you can deploy it with pulumi up:
You must supply two values to deploy the cluster. You can input both through the new-project wizard:
- mgmtGroupId
The object ID of an existing Azure AD group that will serve as the cluster administrator.
- sshPubKey
The contents of the public key used for SSH access to the cluster nodes.
Once the project is created, you can deploy it with pulumi up:
The template requires no additional configuration. Once the new project is created, you can deploy it immediately with pulumi up:
pulumi upWhen the deployment completes, Pulumi exports the following stack output values:
- rgname
The name of the Azure Resource Group containing the Kubernetes cluster resources.
- vnetName
The name of the Azure Virtual Network used for worker nodes, apps, and workloads.
- clusterName
The name of the AKS cluster.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.
- rgname
The name of the Azure Resource Group containing the Kubernetes cluster resources.
- vnetName
The name of the Azure Virtual Network used for worker nodes, apps, and workloads.
- clusterName
The name of the AKS cluster.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.
- rgname
The name of the Azure Resource Group containing the Kubernetes cluster resources.
- vnetName
The name of the Azure Virtual Network used for worker nodes, apps, and workloads.
- clusterName
The name of the AKS cluster.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.
- rgname
The name of the Azure Resource Group containing the Kubernetes cluster resources.
- vnetName
The name of the Azure Virtual Network used for worker nodes, apps, and workloads.
- clusterName
The name of the AKS cluster.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.
- rgname
The name of the Azure Resource Group containing the Kubernetes cluster resources.
- vnetName
The name of the Azure Virtual Network used for worker nodes, apps, and workloads.
- clusterName
The name of the AKS cluster.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.
- cluster_name
The name of the AKS cluster.
- kubeconfig
The cluster’s kubeconfig file, which you can use with
kubectlto access and communicate with your cluster.
Output values like these are useful in many ways, most commonly as inputs for other stacks or related cloud resources.
Customizing the project#
Projects created with the Kubernetes Cluster template expose the following configuration settings:
- numWorkerNodes
The number of nodes in your cluster. Defaults to
3.- kubernetesVersion
The version of Kubernetes used in your AKS cluster. Defaults to
1.24.3.- prefixForDns
The unique DNS prefix for your AKS cluster. Defaults to
pulumi.- nodeVmSize
The VM instance type used to run your nodes. Defaults to
Standard_DS2_v2.
- numWorkerNodes
The number of nodes in your cluster. Defaults to
3.- kubernetesVersion
The version of Kubernetes used in your AKS cluster. Defaults to
1.24.3.- prefixForDns
The unique DNS prefix for your AKS cluster. Defaults to
pulumi.- nodeVmSize
The VM instance type used to run your nodes. Defaults to
Standard_DS2_v2.
- numWorkerNodes
The number of nodes in your cluster. Defaults to
3.- kubernetesVersion
The version of Kubernetes used in your AKS cluster. Defaults to
1.24.3.- prefixForDns
The unique DNS prefix for your AKS cluster. Defaults to
pulumi.- nodeVmSize
The VM instance type used to run your nodes. Defaults to
Standard_DS2_v2.
- numWorkerNodes
The number of nodes in your cluster. Defaults to
3.- kubernetesVersion
The version of Kubernetes used in your AKS cluster. Defaults to
1.24.3.- prefixForDns
The unique DNS prefix for your AKS cluster. Defaults to
pulumi.- nodeVmSize
The VM instance type used to run your nodes. Defaults to
Standard_DS2_v2.
- numWorkerNodes
The number of nodes in your cluster. Defaults to
3.- kubernetesVersion
The version of Kubernetes used in your AKS cluster. Defaults to
1.24.3.- prefixForDns
The unique DNS prefix for your AKS cluster. Defaults to
pulumi.- nodeVmSize
The VM instance type used to run your nodes. Defaults to
Standard_DS2_v2.
- node_count
The number of worker nodes in the cluster. Defaults to
3.- dns_prefix
The unique DNS prefix to use for the cluster. Defaults to
pulumi.- node_vm_size
The VM size to use for worker nodes. Defaults to
Standard_DS2_v2.
All of these settings are optional and may be adjusted either by editing the stack configuration file directly (by default, Pulumi.dev.yaml) or by changing their values with pulumi config set:
pulumi config set numWorkerNodes 5pulumi uppulumi config set numWorkerNodes 5pulumi uppulumi config set numWorkerNodes 5pulumi uppulumi config set numWorkerNodes 5pulumi uppulumi config set numWorkerNodes 5pulumi uppulumi config set node_count 5pulumi upCleaning up#
You can cleanly destroy the stack and all of its infrastructure with pulumi destroy:
pulumi destroyLearn more#
- Browse other architecture templates in the Templates gallery.
- Explore the Azure Native provider API docs in the Pulumi Registry.
- Walk through Pulumi from the ground up in Pulumi Tutorials.
- Read the latest Kubernetes posts on the Pulumi blog.