Skip to content
Terraform module for creating a Kubernetes cluster on Microsoft Azure with latest available version, kubeconfig file creation and addititonal node pool.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Terraform Kubernetes on Microsoft Azure

This repository contains the Terraform module for creating a simple but ready-to-use Kubernetes Cluster on Microsoft Azure Kubernetes Service (AKS).

It uses the latest Kubernetes version available in the Azure location and creates a kubeconfig file at completion.

Link to my comprehensive blog post (beginner friendly):

Azure Logo


You need a Microsoft Azure account with a subscription (for example a Pay-As-You-Go subscription).


  • Always uses latest Kubernetes version available at Azure location
  • kubeconfig file generation
  • Creates public IP address (e.g. for nginx-ingress)
  • OPTIONAL: Container Logs via Log Analytics ContainerInsights



See tables at the end for a comprehensive list of inputs and outputs.

  • Default region: West Europe (Netherlands)
  • Default node type: Standard_D1_v2 (1x vCPU, 3.75GB memory)
  • Default node pool size: 2


terraform apply:


2.56s user
0.89s system
7:16.37 total
2.38s user
0.75s system
5:15.77 total

7.11s user 2.30s system 6:44.52 total

Terraform Inputs

Name Description Type Default Required
enable_microsoft Enable / Disable Microsoft Azure k8s bool true yes
random_cluster_suffix Random 6 byte hex suffix for cluster name string yes
ssh_public_key Path to your SSH public key string ~/.ssh/ yes
az_client_id Azure Service Principal appId string yes
az_client_secret Azure Service Principal password string yes
az_tenant_id Azure Service Principal tenant string yes
aks_region AKS region string West Europe yes
enable_logs Enable azure log analtics for container logs bool false yes
aks_name AKS cluster name string k8s yes
aks_nodes AKS Kubernetes worker nodes number 2 yes
aks_node_type AKS node pool instance type string Standard_D1_v2 yes
aks_pool_name AKS agent node pool name string k8snodepool yes
aks_node_disk_size AKS node instance disk size in GB number 30 yes


Name Description
kubeconfig_path_aks Kubernetes kubeconfig file
latest_k8s_version Latest Kubernetes Version available in Azure location
public_ip_address Public IP address
public_ip_fqdn Public Fully Qualified Domain Name (FQDN)
You can’t perform that action at this time.