Skip to content

Deploying to AKS

Chant supports cross-lexicon projects where Azure infrastructure and Kubernetes workloads live in the same src/ directory. The Azure lexicon produces an ARM template; the K8s lexicon produces kubectl-ready YAML.

┌─────────────────────────────────────────────────────────┐
│ Azure Lexicon (ARM) │
│ ├── VNet + Subnets + NSG + Route Table │
│ ├── AKS Cluster (SystemAssigned identity) │
│ ├── Container Registry (Premium, admin disabled) │
│ ├── 3× Managed Identities (app, dns, monitor) │
│ ├── Role Assignments (ACR Pull, DNS Contributor, etc.) │
│ └── Azure DNS Zone │
└────────────────────┬────────────────────────────────────┘
│ client IDs via .env → config.ts
┌────────────────────▼────────────────────────────────────┐
│ K8s Lexicon │
│ ├── Namespace (quotas, limits, network policy) │
│ ├── AutoscaledService (Deployment + HPA + PDB) │
│ ├── WorkloadIdentityServiceAccount (AKS) │
│ ├── AGIC Ingress + AksExternalDnsAgent │
│ ├── AzureDiskStorageClass │
│ └── AzureMonitorCollector │
└─────────────────────────────────────────────────────────┘

ARM template outputs map to K8s composite props via .env:

ARM OutputK8s Composite Prop
APP_CLIENT_IDAksWorkloadIdentityServiceAccount({ clientId })
EXTERNAL_DNS_CLIENT_IDAksExternalDnsAgent({ clientId })
MONITOR_CLIENT_IDAzureMonitorCollector({ clientId })
AZURE_TENANT_IDtenantId props on multiple composites
AKS_CLUSTER_NAMEclusterName props

Values flow through .envconfig.ts → K8s source files. npm run load-outputs refreshes .env after any infra deploy.

The K8s lexicon provides AKS-specific composites for the workload side:

  • AksWorkloadIdentityServiceAccount — ServiceAccount with Azure client ID annotation
  • AgicIngress — Ingress with Application Gateway annotations, WAF, health probes
  • AzureDiskStorageClass — Azure Disk CSI StorageClass (Premium/Standard/Ultra)
  • AzureFileStorageClass — ReadWriteMany StorageClass via Azure Files (SMB/NFS)
  • AksExternalDnsAgent — Azure DNS record management
  • AzureMonitorCollector — Log Analytics + OTel metrics

See the AKS Composites reference for full API details.

Terminal window
az group create --name $AZURE_RESOURCE_GROUP --location eastus
npm run build # Build ARM template + K8s manifests
npm run deploy-infra # Deploy ARM template
npm run configure-kubectl # Set up kubeconfig
npm run load-outputs # Write client IDs to .env
npm run build:k8s # Rebuild K8s with real values
npm run apply # kubectl apply