Cluster.dev uses stack templates to generate users' projects in a desired cloud. AKS-Azure is a stack template that creates and provisions Kubernetes clusters in Azure cloud by means of Azure Kubernetes Service (AKS).
In this repository you will find all information and samples necessary to start an AKS cluster on Azure with Cluster.dev.
The resources to be created:
- Azure DNS Zone
- Azure Virtual Network
- AKS Kubernetes cluster with addons:
- cert-manager
- ingress-nginx
- external-secrets (with Azure Key Vault backend)
- external-dns
- argocd
- Terraform version >= 1.4
- Azure account and a subscription.
- Azure CLI installed and configured with your Azure account.
- kubectl installed.
- Cluster.dev client installed.
- Parent Domain
- Clone example project:
git clone https://github.com/shalb/cdev-azure-aks.git cd examples/
- Update project.yaml
name: demo-project kind: Project backend: azure-backend variables: location: eastus domain: azure.cluster.dev resource_group_name: cdevResourceGroup state_storage_account_name: cdevstates state_container_name: tfstate kubernetes_version: 1.27.9
- Create Azure Storage Account and a container for terraform backend
az group create --name cdevResourceGroup --location EastUS az storage account create --name cdevstates --resource-group cdevResourceGroup --location EastUS --sku Standard_LRS az storage container create --name tfstate --account-name cdevstates
- It may be necessary to assign the
Storage Blob Data Contributor
andStorage Queue Data Contributor
roles to your user account for the storage accountSTORAGE_ACCOUNT_ID=$(az storage account show --name cdevstates --query id --output tsv) USER_OBJECT_ID=$(az ad signed-in-user show --query id --output tsv) az role assignment create --assignee "$USER_OBJECT_ID" --role "Storage Blob Data Contributor" --scope "$STORAGE_ACCOUNT_ID" az role assignment create --assignee "$USER_OBJECT_ID" --role "Storage Queue Data Contributor" --scope "$STORAGE_ACCOUNT_ID"
- Edit variables in the example's files, if necessary.
- Run
cdev plan
- Run
cdev apply
- Setup DNS delegation for subdomain by creating
NS records for subdomain in parent domain.
Run
cdev output
add records from name_server listdomain = demo.azure.cluster.dev. name_servers = [ "ns1-36.azure-dns.com.", "ns2-36.azure-dns.net.", "ns3-36.azure-dns.org.", "ns4-36.azure-dns.info." ]
- Connect to AKS cluster. Run
cdev output
.Execute command inkubeconfig_cmd = az aks get-credentials --name <aks-cluster-name> --resource-group <aks-cluster-resource-group> --overwrite-existing
kubeconfig_cmd
- Retrieve ArgoCD admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
- Run
cdev destroy
- Remove NS records for subdomain in parent domain
- Delete Azure Storage Account and a container for terraform backend
az group delete --name cdevResourceGroup