This folder contains a basic example for provisioning a "Managed Kubernetes Cluster"
from Microsoft Azure using Terraform.
The Terraform scripts deploy an instance of
Azure Kubernetes Service (AKS) with two node pools
of customizable
Azure VM types
called default
and database
pool.
This is just a basic example. For detailed information on all configuration
options visit the azurerm_kubernetes_cluster
docs.
- Azure CLI installed
- Terraform installed
- Microsoft Azure subscription
-
Clone this repo and switch to the provisioning/ms-azure folder.
git clone --depth 1 https://github.com/tum-gis/sddi-ckan-k8s cd sddi-ckan-k8s/provisioning/ms-azure
-
Run Terraform initialization
terraform init
-
Decide for Azure VM types and count for both node pools, a name of the
resource group
, and provide one or more email addresses for budget warning notifications. Pass these options toterraform plan
to create an execution plan.terraform plan -out plan.json \ -var resource_group_name="ckan-aks-rg" \ -var 'contact_emails=["[email protected]","[email protected]"]' \ -var k8s_default_node_type="Standard_A2_v2" \ -var k8s_default_node_count=2 \ -var k8s_database_node_type="Standard_D4s_v3" \ -var k8s_database_node_count=1
-
Apply the plan to book the specified resources.
terraform apply plan.json
-
The access credentials of the AKS instance are output in
.kubeconfig
. Store the credentials in a safe place and add them to your~/.kube/config
file to use them with e.g.kubectl
. After that, it is recommended to delete the file.