How pacroy/microk8s-azure-vm works
Project type and purpose
• This is a Terraform-based infrastructure-as-code (IaC) project that automates provisioning of a single-node MicroK8s Kubernetes cluster on an Azure VM.
• Its primary goal is to minimize cost by running non-critical workloads on a single VM, while exposing SSH, kubectl and application ingress endpoints via an Azure public load balancer.
File structure
• Top-level Terraform files define providers, variables, locals, resources, outputs, and the load balancer:
• providers.tf – Azure provider setup
• variables.tf – input variables (resource group, suffix, IP ranges)
• locals.tf – computed locals for naming conventions and port ranges
• main.tf – core resources (VNet, subnet, NSG, NIC, VM)
• loadbalancer.tf – public IP and load balancer + rules for SSH, kubectl, HTTP/HTTPS, outbound SNAT
• outputs.tf – exposed Terraform outputs (SSH port, public IP, FQDN, kubectl port)
• init.cfg.tftpl – cloud-init template for VM bootstrap (install/upgrades, MicroK8s, ingress, cert-manager, Let’s Encrypt, OS upgrades)
• CI/CD and quality checks via GitHub Actions (linter.yml, mdlink.yml), mdlink config, and sync workflows.
README for additional insights
• Resources created: virtual network → subnet → NSG → VM with public load balancer
• Cloud-init config installs and configures MicroK8s with DNS, storage, Helm3, ingress-nginx, cert-manager, ACME issuer
• Two execution modes: Terraform Cloud (remote) or local with Azure CLI
• End-to-end workflow: terraform init → apply → SSH & kubectl connectivity → download KUBECONFIG → DNS record update.
Final reminders
• Don’t omit the cloud-init bootstrap step—this is critical for the immutable setup of MicroK8s and add-ons.