How mahdi2ba/private-aks-cluster-terraform-devops-1 works
Project type and purpose
• This is a full-stack Infrastructure-as-Code (IaC) + CI/CD solution that automates the provisioning of a private Azure Kubernetes Service (AKS) cluster and related Azure resources using Terraform, and the deployment of workloads (test web app, Redmine, self-hosted agents) via Azure DevOps pipelines and Helm.
File structure
• Top-level folders:
• agent – Terraform module to deploy a self-hosted Azure DevOps agent VM
• chart – Helm chart for the test web application
• pipelines – Azure DevOps YAML pipelines (CI/CD, destroy, self-hosted agent, Redmine via Helm, test web app)
• source – ASP.NET Core web app code + Dockerfile + Razor Pages
• storage-account – Terraform module + scripts to deploy a storage account for remote state
• terraform – Root Terraform configuration and modules for AKS, networking, firewall, ACR, key vault, diagnostics, bastion, node pools, etc.
• tfvars – Environment-specific variable files
• key-vault – Script to provision an Azure Key Vault and store secrets for DevOps variable groups
Extract architectural insights from the README
• The solution uses:
• Hub-and-spoke VNets with Azure Firewall and Bastion in the hub, AKS cluster & jumpbox VM in the spoke
• Private endpoints for ACR, Storage Account, Key Vault, plus Private DNS zones with VNet links
• Terraform remote state stored in an Azure Storage Account
• Azure DevOps pipelines orchestrating Terraform (init, plan, apply, destroy) and deploying workloads via Helm and Azure CLI on a self-hosted agent
• Log Analytics workspace for monitoring
Main components
a. Azure DevOps (organization, repo, pipelines, variable groups)
b. Terraform remote state (Azure Storage Account + Blob container)
c. Terraform modules (networking, AKS, ACR, storage, key vault, firewall, bastion, self-hosted agent)
d. Azure network topology (hub VNet + subnets: AzureFirewallSubnet, AzureBastionSubnet; spoke VNet + subnets: SystemSubnet, UserSubnet, VmSubnet; VNet peering)
e. Private endpoints & Private DNS zones (for ACR, storage, key vault) and DNS zone links
f. AKS cluster (private API server endpoint, system & user node pools, managed identity)
g. Azure Firewall (DNAT & UDR rules)
h. Jumpbox VM + Azure Bastion
i. Azure Container Registry (Premium SKU with private endpoint)
j. Azure Key Vault
k. Log Analytics workspace
l. Workloads:
– Test web app (Docker image in ACR, Helm chart)
– Redmine via Helm
– Azure DevOps self-hosted agent VM
Relationships and data flows
• Pipelines check out code → run Terraform on Azure DevOps agent → Terraform uses remote state in storage account → Terraform provisions Azure resources
• CI pipeline builds Docker image → pushes to ACR → pushes Helm chart to ACR
• CD pipeline (self-hosted agent) connects to private AKS endpoint through jumpbox → uses Helm to deploy workloads
• AKS cluster communicates privately with ACR, storage, Key Vault via private endpoints → uses Private DNS zones for name resolution
• Outbound egress from AKS node pools routed through Azure Firewall via UDRs
• Inbound workload traffic arrives at Azure Firewall public IP → DNAT rule → forwarded to internal Standard Load Balancer of AKS (or NGINX ingress) → pod
• Jumpbox VM is reachable via Azure Bastion
Architectural patterns and principles
• Hub-and-spoke networking for multitenancy and isolation
• Modular Terraform code with separate modules per resource type
• Remote state management for collaboration and locking
• Git-Ops style pipelines (CI builds artifacts, CD deploys infra + apps)
• Private Link for service access and least-privilege networking
• Clear separation of infrastructure provisioning (Terraform) and application deployment (Helm + Azure CLI)