This repository provides automation scripts to set up and tear down an Azure Kubernetes Service (AKS) management cluster with Cluster API (CAPI) and GitOps using FluxCD. The scripts are designed for self-service AKS provisioning and management, following best practices for Azure and Kubernetes.
- 🟦 Azure CLI (
az
)>= 2.50.0
- ☸️ kubectl
>= 1.25.0
- 🔄 Flux CLI
>= 2.1.0
- 🏗️ clusterctl
>= 1.5.0
- 🎛️ Helm
>= 3.13.0
- 📦 jq (for JSON parsing)
- ☁️ Azure subscription with sufficient permissions
- 🐙 GitHub Personal Access Token (PAT) with repo and workflow permissions
-
Clone the repository:
git clone https://github.com/jaredthivener/azure-cluster-api.git cd azure-cluster-api
-
Configure the scripts:
- ✏️ Edit
setup.sh
and update the Azure and GitHub configuration variables at the top of the script as needed. - 🔑 Ensure your GitHub PAT is set in the
GITHUB_TOKEN
variable or will be prompted at runtime.
- ✏️ Edit
-
Run the setup script:
./setup.sh
This will:
- ✅ Verify prerequisites
- 🔐 Log in to Azure and set the subscription
- ☸️ Create the resource group and AKS management cluster (if not present)
- 🏗️ Install Cluster API with Azure provider
- 🔄 Bootstrap FluxCD for GitOps
To remove all resources created by the setup script, run:
./cleanup.sh
🛑 You will be prompted for confirmation before destructive actions.
clusters/
— Contains FluxCD manifests and kustomizations for GitOps.templates/cluster-templates/
— Contains reusable Cluster API templates.templates/cluster-templates/skeleton/
— Example skeleton for a CAPI cluster.
- 📝 The scripts log output to timestamped log files in the working directory.
- 🔒 Ensure you have the necessary Azure and GitHub permissions before running the scripts.
- ♻️ The scripts are idempotent and can be safely re-run; they check for existing resources before creating new ones.
See backstage-cluster-api.drawio
for an architecture diagram of the setup.
MIT License
👤 Author: Jared Thivener
📅 Created: 2025-04-05