Skip to content

Terraform module for creating a Kubernetes cluster on Microsoft Azure with latest available version, kubeconfig file creation and addititonal node pool.

License

Notifications You must be signed in to change notification settings

hajowieland/terraform-azurerm-k8s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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):

https://napo.io/posts/terraform-kubernetes-multi-cloud-ack-aks-dok-eks-gke-oke/#microsoft-azure

Azure Logo

Requirements

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

Features

  • 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

Notes

Defaults

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

Runtime

terraform apply:

~5-7min

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/id_rsa.pub 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

Outputs

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)

About

Terraform module for creating a Kubernetes cluster on Microsoft Azure with latest available version, kubeconfig file creation and addititonal node pool.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages