The clusters of OneK8s - one Kubernetes platform for every cloud: minimal Terraform for deploying AKS clusters with Azure Verified Modules, and the environment's container registry. Azure is the first cloud implemented; the applications and their deployment (Flux, the Gateway API, open standards - see the design's open standards and portability) are meant to move to another cloud unchanged.
| Repository | Role |
|---|---|
| onek8s.github.io | The design |
| azure-landing-zone | The Azure landing zone: tenant, management groups, policy, hub, subscriptions |
| aks-terraform | The AKS clusters and what an environment's clusters share: network, Key Vault, container registry, DNS |
| aks-fluxcd-platform | What Flux deploys into every cluster |
| aks-fluxcd-example | An application team's repository |
| aks-hello | The example application |
| aks-ai-agents | AI agents for day-2 operations |
There is a single root module at the repository root. Everything an environment differs by lives in
a variables file under envs/ - no per-environment Terraform code.
Every cluster is a cell of the OneK8s design: attached to the environment's resources that shared/
creates - its resource group, its own network, the vaults, the registry - with a private API server
(design D58) and Azure RBAC on every call.
| Path | Purpose |
|---|---|
main.tf, variables.tf, locals.tf, outputs.tf, terraform.tf |
The root module. Wraps Azure/avm-res-containerservice-managedcluster/azurerm 0.8.5 from the registry (Image Integrity, which it has no input for, is set beside it in image_integrity.tf): looks up the existing resources by name, creates the cluster identity and its role assignments, the private API server and the zones' node pools (zones.tf). No tenant: see Tenants. |
key_vault.tf |
The cluster's federated credentials on the platform namespaces' identities of the platform vault. See Key Vault. |
tenants/ |
The environment's tenants, a root module and state of its own (stack dev-tenants): one file per tenant in tenants/catalogue/<env>/<namespace>.yaml, turned into its managed namespace, access, Flux configurations and federated credential in every cell of its zone. See Tenants. |
envs/dev-int-stateless.tfvars, envs/dev-int-stateless-az3.tfvars, envs/dev-int-stateful.tfvars |
The dev environment's clusters, in germanywestcentral: the lab's one stateless cell aks-dev-int-stateless-az3 (availability zone 3, Sweden's zone int-se) and aks-dev-int-stateful (defined, not deployed). dev-int-stateless.tfvars holds what every cell shares - the cost savings, the environment's resources, the private API server - and is applied before the cell's own file (name, network, zones). See Cells of the OneK8s design. |
shared/ |
The environment's shared resources, a root module and state of its own: the resource group and network, the Key Vault, the identities the namespaces read it as, the private DNS zone and the container registry and the images it builds. shared/envs/dev.tfvars is the dev environment's. See Shared resources. |
modules/conventions/ |
What the two root modules have to work out the same way: the naming policy and its region codes, the shared identities' names, the ABAC conditions of a namespace's share of the vault. |
scripts/policy-name.sh |
The naming policy's name of one resource, for the workflows that need a name no variables file states. |
tests/aks.tftest.hcl |
terraform test suite. The providers are mocked, so it plans the whole configuration - role assignment scopes, upgrade windows, every input validation - without a subscription. |
plan-risk/ |
The high-risk change rules Deploy checks every plan against (Rego, Conftest), with their tests. See Usage. |
backend.hcl.example |
Template for the shared remote state backend. |
.tflint.hcl, .github/ |
Lint configuration, the CI workflow that runs the offline checks, the manual deploy workflow for the dev environment's stacks, and the Dependabot schedule that watches the pinned module and provider versions. |
These must exist before running Terraform:
- The environment's shared resources, applied: the resource group, the cell's virtual network with the system pool's node and pod subnets and each isolation zone's, the Key Vaults, the registry and the Log Analytics workspace. The cluster looks them up by name.
- The one DNS zone the Gateway's hostnames are published in - a public Azure DNS zone, or with
dns_zone_privatean Azure Private DNS zone - only wheredns_zone_namenames it.shared/creates it, or it is provisioned outside Terraform (dev's publiconek8s.lol, inrg-onek8s-dns). See Certificates and DNS.
The identity running Terraform needs Contributor on the resource group, permission to create role
assignments on the network and the DNS zones, and role definitions on the resource group for
portable_disks_enabled.
The subscription needs the preview features and resource providers the clusters use - the managed
Gateway API CRDs, AKS Image Integrity (Ratify, with image_integrity_enabled), encryption at host, the
Azure Policy add-on and, with a Flux repository, the Flux extension. The Deploy
workflow registers them all; by hand:
az feature register --namespace Microsoft.ContainerService --name ManagedGatewayAPIPreview
az feature register --namespace Microsoft.ContainerService --name EnableImageIntegrityPreview
az feature register --namespace Microsoft.Compute --name EncryptionAtHost
az provider register --namespace Microsoft.ContainerService
az provider register --namespace Microsoft.PolicyInsights
az provider register --namespace Microsoft.KubernetesConfigurationEdit the environment's variables file to name your existing resources, then apply it:
az login
terraform init
terraform workspace select -or-create dev-int-stateless-az3
terraform apply -var-file=envs/dev-int-stateless.tfvars -var-file=envs/dev-int-stateless-az3.tfvarsA stateless cell takes two files: what every cell of the environment shares, then its own (a later file wins where both set a variable). The stateful cluster takes its file alone.
An environment with shared resources applies them first, from shared/:
cd shared
terraform init
terraform workspace select -or-create dev
terraform apply -var-file=envs/dev.tfvarsOne root module serves every environment, so each environment needs its own state. Locally that is one workspace per environment, as above. Adding an environment means adding a variables file; nothing else changes.
Anything beyond a prototype belongs in remote state: local state is not shared, not locked and not
backed up. Uncomment backend "azurerm" in terraform.tf, copy backend.hcl.example to
backend.hcl, and give each environment its own key:
terraform init -backend-config=backend.hcl -backend-config="key=dev-int-stateless-az3.tfstate"The backend holds a blob lease for the duration of an apply, so two people cannot write the same state at once. Turn on versioning and soft delete for the container too - a truncated state file is only recoverable if an earlier version survives.
The dev environment is deployed from GitHub: the Deploy workflow,
started by hand, plans one of its stacks - dev-shared (shared/), dev-int-stateless-az3 or
dev-int-stateful - and, when run with apply, applies that plan; destroy deletes a cluster stack (never dev-shared), for a change a cluster cannot take in place, such as moving its nodes between amd64 and arm64. Each stack has its state as <stack>.tfstate. It runs in the
dev GitHub environment, signs in as the identity of the AZURE_* variables - a service principal
with the AZURE_CLIENT_SECRET secret, or GitHub OIDC without it - and keeps the state in the
storage account of the variables TF_STATE_RESOURCE_GROUP and TF_STATE_STORAGE_ACCOUNT, in
sub-aks-dev itself (created on the first run), so a lab reset takes it with the resources. It refuses to plan against an empty state unless told it is a first
deployment.
Before an apply, Deploy checks the plan against the rules in plan-risk/: changes
the plan shows as ordinary in-place updates but that AKS or the network turns into a node rollover or an
outage - a node pool property that reimages or replaces its nodes (LocalDNS, OS SKU, kubelet and OS
config, encryption at host, Kubernetes version, VM size), a deleted node pool or cluster, a cluster's
network or API server access, a route table's routes, a subnet's private endpoint policy, a deleted
network or Key Vault key. Each finding is a warning in the run and its summary, with the resource and
property only (the plan JSON stays on the runner). A plan only reports them; an apply stops on
them unless accept_risk is set - take the cell out of traffic first. A new lesson of that kind is a
new rule with its test in plan-risk/risk_test.rego (conftest verify --policy plan-risk, run by CI).
The configuration can be checked without an Azure subscription at all, which is exactly what CI runs on every pull request:
terraform fmt -check -recursive
terraform validate
terraform test
tflint --init && tflint
conftest verify --policy plan-riskLocal Kubernetes accounts are disabled, so there is no cluster-admin certificate to hand around
and az aks get-credentials --admin does not work. Everything authenticates as an Entra ID
identity, and Azure RBAC decides what that identity may do inside the cluster.
az aks get-credentials --resource-group <resource_group_name> --name "$(terraform output -raw name)"
kubectl get nodesTwo things have to be granted before that returns anything:
Azure Kubernetes Service Cluster User Roleon the cluster, to download a kubeconfig at all. This one is never created here.- A Kubernetes-level role: every group in
entra_admin_group_object_idsis assignedAzure Kubernetes Service RBAC Cluster Adminon the cluster, every group inentra_reader_group_object_idsAzure Kubernetes Service RBAC Reader. Anything narrower is a namespace'sgroups- see Tenants.
Because the API server is private, the kubeconfig only resolves from a network that reaches it: the
labfw VPN in the lab. az aks command invoke runs a command in the cluster through the Azure control
plane instead:
az aks command invoke --resource-group <resource_group_name> \
--name "$(terraform output -raw name)" --command "kubectl get nodes"A tenant is an application namespace, <zone>-<app>, and it is not part of a cell: the cells
(this root module) build clusters, and tenants/ - a root module with a state and a pipeline of its
own (Deploy's dev-tenants) - builds the tenants into every cell that holds their zone. A tenant is
one file, tenants/catalogue/<env>/<namespace>.yaml, and nothing else in any repository:
# tenants/catalogue/dev/int-se-payments.yaml
zone: int-se
owner:
team: payments
cost_center: cc-1234
contact: https://github.com/example/payments/issues
groups:
edit: 00000000-0000-0000-0000-000000000000
flux:
url: https://github.com/example/payments-deploy
path: ./overlays/devFrom it tenants/ makes, in each cell of the zone (tenants/envs/<env>.tfvars lists the cells and
their zones; cells: [...] in the file narrows it):
- the managed namespace with its quota, default network policies, Pod Security Standard
and the labels
platform/zone,platform/team,platform/cost-center(and annotationplatform/contact); - the team's own Flux configuration
<namespace>(namespace-scoped, see Tenants under GitOps); - the platform's Flux configuration
<namespace>-access: a RoleBinding per group role, andstore- the namespace'skey-vaultservice account and SecretStore on its zone's vault, and its default service account (aks-fluxcd-platforminfrastructure/tenant, the same directory for every tenant); Azure Kubernetes Service Namespace Userfor each group, and the federated credential of the namespace's vault identity for the cell.
shared/ reads the same files for the namespace's share of its zone's vault (writers, and the
groups' rights on it). So a new tenant is reviewed as one file, planned and applied by the tenants
stack alone - its plan shows only tenants - and never changes a cell's plan or the fleet repository.
Every rule a tenant must meet is a precondition of the stack's tenants output: a failing one stops
the plan and names what is wrong. Apply order for a new tenant: dev-shared (its vault share), then
dev-tenants.
The catalogue's schema is tenants/schema (a typed variable: a misspelt attribute is refused);
namespace_defaults in tenants/envs/<env>.tfvars is what every tenant falls back to.
Moving tenants out of a cell's state (the lab, 2026-11; tenants/imports.tf): the cell forgets its
namespace resources (removed blocks, nothing destroyed) and tenants/ imports them. Order: merge,
plan dev-shared (no change expected), apply dev-tenants (imports, plus each tenant's store), merge
the fleet's change that drops its per-tenant tenants/ directories and cluster settings, then apply the
cell. The fleet's old tenants
Kustomizations hand their objects over: the new <namespace>-access-store applies them first and
takes their owner labels, so pruning the old one deletes nothing.
| Default | What it means | |
|---|---|---|
network_policy.ingress |
AllowSameNamespace |
Only pods of the same namespace can open a connection to a pod in it. |
network_policy.egress |
AllowSameNamespace |
A pod may open connections only to pods of its own namespace - nothing in another namespace. What else it reaches the platform adds: DNS, and outside the cluster through the hub firewall (aks-fluxcd-platform's zone policies). |
adoption_policy |
Never |
A Kubernetes namespace of that name that already exists fails the apply instead of being taken over. |
delete_policy |
Keep |
Removing the entry deletes the Azure resource and leaves the Kubernetes namespace, and whatever runs in it, standing. |
resource_quota |
2 cores and 4Gi of limits, 500m and 1Gi of requests | Azure requires a quota on every managed namespace, so this is a ceiling to raise or lower rather than one to turn off. |
pod_security |
restricted |
The namespace is held to the hardened Pod Security Standard, enforced, audited and warned about - see Pod Security Standards. |
Everything inside the namespace, nothing between namespaces is the shape this settles on, in both directions: a compromised or misconfigured workload in one namespace can neither be reached from another nor reach into one. Policies add up, so the platform's own policies open what every application needs beside it - DNS to CoreDNS, and the world outside the cluster, where the hub firewall decides per application (design section 5.1) - without a namespace reaching its neighbours.
These are the namespace's default policies, not a ceiling. Kubernetes network policies are
additive, so a NetworkPolicy applied inside the namespace can only widen what these permit -
tightening egress for a particular workload is done by narrowing it here, not inside the cluster.
Anything in the table can be overridden on a single namespace:
# tenants/catalogue/dev/int-se-search.yaml: calls the Services of other namespaces.
network_policy:
egress: AllowAll
resource_quota:
cpu_limit: "4"
memory_limit: 8Gi...or for every tenant of the environment at once through namespace_defaults in
tenants/envs/<env>.tfvars, which is what every tenant falls back to:
namespace_defaults = {
labels = { "cost-centre" = "platform" }
delete_policy = "Delete"
}Both ingress and egress take AllowAll, AllowSameNamespace or DenyAll. labels and
annotations merge with the defaults key by key, so a namespace adds to the estate-wide set rather
than replacing it; everything else is a plain override. A namespace that names no quota figures is
sent the four figures of namespace_defaults rather than none at all.
Quota figures are written the way a manifest writes them - "500m", "0.5" or "2" for CPU,
"512Mi" or "4Gi" for memory. Azure takes the CPU ones in milliCPU alone, so "2" is sent on as
"2000m" and a figure finer than a milliCPU is refused rather than rounded away.
Every namespace has a quota. Azure requires all four figures on a managed namespace - the API
spec marks the quota optional and the service refuses a namespace that arrives without one - so
resource_quota sets a ceiling rather than deciding whether there is one. The figures cap the sum
of what the pods in the namespace request and are limited to, which also means a pod that declares
neither a request nor a limit is refused by the quota; a LimitRange inside the namespace is what
gives such pods their figures. A namespace that needs more room says so:
resource_quota:
cpu_limit: "8"
memory_limit: 16GiEvery managed namespace is held to the restricted Pod Security Standard unless it says
otherwise. There is nothing to install: the standard is applied as the
pod-security.kubernetes.io/* labels the API server's built-in Pod Security Admission
controller reads, so a labelled namespace is an enforced one.
Each namespace gets all three modes at restricted:
| Mode | What it does |
|---|---|
enforce |
Rejects a pod that breaks the standard. |
audit |
Records the violation in the API server audit log and lets the pod through. |
warn |
Returns a warning to whoever applied it and lets the pod through. |
restricted is genuinely strict - it wants runAsNonRoot, allowPrivilegeEscalation: false,
seccompProfile: RuntimeDefault and all capabilities dropped - and plenty of off-the-shelf charts
do not meet it as shipped. That is the point of it being the default: a workload that needs more has to say so, in its catalogue file, where it is reviewed.
An exception is stated on the namespace that needs it, not by lowering the standard for the cluster:
# Charts that are not quite there yet, held at the middle standard while they catch up.
pod_security:
enforce: baseline
warn: baselineEach mode takes restricted, baseline, privileged - the level that permits everything, and so
the normal way to write an exception - or none, which leaves that label off the namespace
entirely.
Relaxing enforce on its own leaves audit and warn where they were. The pods that break the
standard still land in the audit log and still warn whoever applies them, so the exception is
visible and can be walked back later. Terraform warns when a namespace relaxes enforce and turns
off both of the other two: that is an exception nothing refuses and nothing records.
version pins the standard to a Kubernetes release:
namespace_defaults = {
pod_security = { version = "v1.31" }
}The default, latest, follows the cluster - which means an AKS upgrade can tighten what a namespace
enforces under a workload that was passing the day before. Pin it in an environment where that
matters, and move the pin deliberately.
The labels are set through pod_security alone; a pod-security.kubernetes.io/* key written into
labels by hand is refused, so a namespace cannot end up with two answers about what it enforces.
groups binds an Entra ID group to each of Kubernetes' user-facing roles in the namespace - view,
edit, admin - as a RoleBinding the cluster's Flux configuration applies, and grants the group
Azure Kubernetes Service Namespace User on the namespace resource, so that its members fetch a
kubeconfig for that namespace alone (az aks namespace get-credentials) and nothing else. The same
groups get the matching rights on the namespace's secrets in its vault (shared/, design D49 and D51).
Group values are object IDs, not names.
- Something has to enforce the policies. A
NetworkPolicyin a cluster with no policy engine is an object nobody reads: the namespace looks closed in Azure and every pod in the cluster can still reach into it. Terraform warns on every plan whennetwork_profile.network_policy = "none"and a namespace restricts anything. - A managed namespace is no longer yours to edit from
kubectl. AKS reconciles the namespace against what Azure holds and blocks changes to its managed fields and labels through the Kubernetes API -kubectl label namespace team-search pod-security.kubernetes.io/enforce=privilegeddoes not work - so an exception goes through the catalogue file. That is the point, but it does mean a team cannot unblock itself at three in the morning. - Names are Kubernetes namespace names: lowercase letters, digits and hyphens. System namespaces
cannot be on-boarded at all -
kube-systemand anything else starting withkube-,gatekeeper-system,istio-system,app-routing-system- and Terraform refuses the ones Microsoft names,flux-system, and the platform's Flux configuration names (platform,tenants-*). A tenant's name starts with its zone,<zone>-. - A namespace grant does not carry over to the cluster.
Azure Kubernetes Service Cluster User Roleand the cluster-wideentra_admin_group_object_idsare separate, and a principal that has only namespace grants cannot runaz aks get-credentialsor see anything outside its namespace - which is the point, but it does meankubectl get nodescomes back forbidden for them. delete_policy = "Keep"leaves the namespace behind. Removing a tenant's file destroys the Azure resource but not the Kubernetes namespace, which is deliberate - a workload should not disappear because a line moved. Clean it up withkubectl delete namespace, or setdelete_policy = "Delete"up front for namespaces that are meant to be disposable.
By default the cluster does not upgrade itself (auto_upgrade channels none and None, design section
3.5: the version pipeline moves a cell while it is drained); the stateful cluster takes OS patches in place
with node_os_channel = "SecurityPatch". Such upgrades, together with the weekly AKS release of the
control plane and add-ons, are confined to a single weekly planned maintenance window. It defaults to the night between Tuesday and
Wednesday, 22:00 - 06:00 UTC.
Change it per environment in the variables file:
maintenance_window = {
day_of_week = "Tuesday"
start_time = "23:00"
duration_hours = 8
utc_offset = "+03:00"
}Azure keeps the window at a fixed UTC offset and does not follow daylight saving time, so an offset matching local winter time drifts an hour during summer time, and vice versa.
The window must be at least four hours long, or AKS does not attempt an upgrade at all. AKS only starts work inside it: an upgrade still running when the window closes is allowed to finish, but nothing new begins. Windows are best effort - AKS reserves the right to break them for urgent, unplanned maintenance.
Pinning kubernetes_version and letting a channel move past it are mutually exclusive, and
Terraform refuses the combination: AKS would upgrade the cluster, the next apply would write the
pinned version back, and Azure rejects a downgrade. Pin the version and set
auto_upgrade = { kubernetes_channel = "none" }, or pin only the minor version and use "patch".
Monitoring is handled by third party solutions running inside the cluster, so nothing is sent to
Azure Monitor. Ingress is the Kubernetes Gateway API, served by App Routing's
Gateway API implementation (gateways_enabled) - see Ingress through the Gateway API. The Azure features that would
otherwise duplicate them are off on every cluster, with no variable to turn them back on:
| Disabled | What it would have done |
|---|---|
Container Insights (omsagent) |
Ships node and pod telemetry to a Log Analytics workspace. |
| Azure Monitor managed Prometheus | Scrapes cluster metrics into an Azure Monitor workspace. |
| Control plane diagnostic setting | Ships the API server, audit and autoscaler logs to a Log Analytics workspace. |
| Defender for Containers | Runs the Defender security agent on the nodes for threat detection. Microsoft Defender is not used: the company's third-party security tool is (design D81). |
Application Routing's NGINX (webAppRouting.enabled, nginx) |
Installs and manages the NGINX ingress controller for the Ingress API, which the platform does not use. App Routing's Gateway API implementation is separate, see below. |
Application Gateway for Containers (applicationLoadBalancer) |
Runs the ALB Controller add-on, which programs an Azure-hosted, public Gateway API load balancer. |
Most of them are stated as disabled rather than simply left unconfigured, because Azure can turn them on by itself otherwise: a subscription running the Defender for Containers plan with auto-provisioning on enables the security agent on clusters as they appear.
Two consequences worth knowing about:
- The control plane's audit log is the one thing collected on the Azure side: the control plane
is not part of the cluster, so no in-cluster agent can pick up
kube-audit-adminorguard; a diagnostic setting (audit_logs.tf) sends them to the environment's Log Analytics workspace (log_analytics_workspace_name, design section 6.2). - Nothing else is billed for ingestion, and the cluster emits platform metrics only.
The AKS cost analysis add-on is off (design D46): cost per namespace and team comes from OpenCost in the clusters' Grafana stack.
The Azure Policy add-on is on by default (azure_policy_enabled), so policy definitions
assigned to the subscription or resource group are enforced inside the cluster rather than merely
reported on.
Every cluster publishes its workloads through the Kubernetes Gateway API. What this configuration provides is the API itself; the controller serving it is deployed through Flux:
| Setting | What it does |
|---|---|
ingressProfile.gatewayAPI.installation = "Standard" |
The managed Gateway API CRDs, standard channel. AKS installs and upgrades them, so nothing else in the cluster may bring its own. |
ingressProfile.webAppRouting.gatewayAPIImplementations.appRoutingIstio.mode |
Enabled with gateways_enabled (the default), else Disabled (the stateful cluster, R21): App Routing's Gateway API implementation, a sidecar-less Istio control plane (istiod in aks-istio-system) serving the GatewayClass approuting-istio. No service mesh, no sidecars, no Istio CRDs; AKS upgrades it in place with the cluster. |
ingressProfile.applicationLoadBalancer.enabled = false |
No Application Gateway for Containers add-on. Stated rather than left out, so a cluster that had it loses it; it keeps the module on a preview API - 2026-03-02-preview, which also knows App Routing Istio. |
App Routing serves every Gateway; the Flux repository names its class, approuting-istio, itself.
istiod requests 500m and 2 GiB per replica, at least two, not customizable (Azure/AKS#5939):
a lab cell runs two system nodes for it. App Routing's Istio does not let a listener refuse HTTP/1.1
or TLS 1.2 (design section 4.1): the edge offers HTTP/2 and HTTP/1.1, TLS 1.2 and 1.3.
For every Gateway of class approuting-istio, istiod creates an Envoy Deployment, a LoadBalancer
Service, an autoscaler (at least two replicas) and a disruption budget in the Gateway's namespace,
shaped by the ConfigMap the Gateway names in spec.infrastructure.parametersRef - within the
add-on's allow list. The Flux repository runs one such Gateway per isolation zone - <zone> in
<zone>-gateway - and, with flux_github_webhook, one for the platform in platform-gateway for
Flux's webhook receivers, all on the system pool. The zones' gateways are on the system pool so that a zone's own nodes exist
only for its applications: a zone without any has none. The system subnet's NSG therefore lets
HTTPS in from the internet and from the virtual network. Each is behind a LoadBalancer Service
of its own:
- An internal zone's is an internal load balancer in the zone's
snet-<zone>-ilb(service.beta.kubernetes.io/azure-load-balancer-internal-subnet), reachable from inside the network only. The cluster identity holdsNetwork Contributoron the whole network (the zones' node pools), which is all AKS needs. - An external zone's, and the platform gateway's, is public: an application's own name, in the public zone, points at it in the application's home cell (design v5.0: no Traffic Manager).
Traffic reaches the pods from the zone's gateway pods inside the cluster, which the platform's Cilium baseline lets in - from the zone's own gateway only.
What App Routing's implementation does not offer: rate limits, request size limits and EnvoyFilter (the
Gateway API has no standard fields for them), egress gateways, and customizing the access log. It
cannot run beside the Istio service mesh add-on.
The Gateway terminates TLS with certificates it reads from Kubernetes Secrets. App Routing's own Key Vault and Azure DNS integration is not used: it would read the vault through the Secrets Store CSI driver, which the design leaves off (R11), and write DNS as one identity for every zone. So both are done from inside the cluster, by workloads the Flux repository deploys, each acting as an identity created here:
-
Certificates are kept in the environment's platform Key Vault as
<zone>-gateway--wildcard- the share of the vault that belongs to the zone's gateway namespace, so a zone's gateway reads its own certificate and no other. External Secrets Operator syncs it into the Secret the zone's listener names, as<zone>-gateway/key-vault, unpacking the secret behind the certificate as PKCS#12 - so a certificate is imported as a.pfx, never as PEM. A new version is picked up within the hour.Each zone's listener serves its zone's wildcard certificate (
*.<zone>.dev.onek8s.lol), and the platform gatewayplatform-gateway--wildcard(*.onek8s.lol), all issued and renewed by the Renew Certificate workflow: Let's Encrypt, with the DNS-01 challenge solved in the environment's publicdns_zone_name- imported into itskey_vault_name, both read from the variables file that creates them -shared/envs/dev.tfvarsfordev,envs/<environment>.tfvarsfor any other. It runs monthly fordev, and whenever the workflow changes onmain, and renews when fewer than 30 days are left; run it by hand for another environment, other domains or the staging CA. It needs the variablesAZURE_CLIENT_ID,AZURE_TENANT_ID,AZURE_SUBSCRIPTION_IDandLETSENCRYPT_EMAILand the secretAZURE_CLIENT_SECRET, for a service principal holdingKey Vault Certificates OfficerandKey Vault Secrets Officeron the vault andDNS Zone Contributoron the zone. The Let's Encrypt account key is kept in the vault beside the certificate, asletsencrypt-account-key- a name in no namespace's share. Other certificates can still be imported by hand by an admin group. -
DNS: the internal zones' names are in Azure Private DNS zones of their own (
internal_dns_zone_names, created byshared/and linked to every cell's network), on which<cluster identity>-dnsis grantedPrivate DNS Zone Contributortoo. Everything else is in one zone,dns_zone_name, public or private (dns_zone_private).<cluster identity>-dnsis federated withexternal-dns/external-dnsand grantedDNS Zone Contributoron a public zone,Private DNS Zone Contributoron a private one; the Flux repository is told the zones' resource IDs (dns_zone_id,internal_dns_zone_ids) for App Routing's managed external-dns (ClusterExternalDNS, which the App Routing add-on brings withgateways_enabled). It keeps a record per route hostname, pointing at the Gateway's address. The zone is looked up inresource_group_nameunlessdns_zone_resource_group_namesays otherwise;shared/creates it (dns_zone_create, a private one linked to the clusters' network), or it exists already. Choosing between public and private is that one setting, alike inshared/and in every cluster. The Let's Encrypt DNS-01 challenge needs a public zone for the certificate's names, and so do the external zones' names. Indevthe zone is the publiconek8s.lol, the only domain.
The vaults are the environment's, created by shared/ with every share and grant on them - see
Shared resources - and looked up by the cluster, which adds its federated
credential to each namespace's identity and nothing else. Every namespace reads only its own secrets:
the namespaces are kept apart by the names of the secrets, with Azure ABAC conditions on the
role assignments.
A namespace owns the secrets named <namespace>--<name> - ext-fi-example--api-key,
ext-fi-gateway--wildcard. The namespaces with a share are every tenant of the catalogue and the
ones in key_vault_namespaces: each zone's gateway and flux-system.
There is more than one vault (OneK8s design section 2.5): shared/ creates the environment's
platform vault (key_vault_name) - the gateways' certificates, the clusters' customer-managed
keys - and one vault per zone (zone_key_vault_names)
for the secrets of the zone's applications. An application namespace's share is in its zone's
vault, the tenant's zone; tenants/ hands the vault's address and the identity to the namespace's
<namespace>-access Flux configuration.
| Who | Role on the vault | Condition |
|---|---|---|
The namespace's key-vault service account, as the environment's id-<region>-<environment>-shared-kv-<namespace> |
Key Vault Secrets User |
Reads the value and the metadata of a secret only if it is the namespace's own; lists nothing |
The namespace's writers (shared/) and its admin group |
Key Vault Secrets Officer |
Creates, reads, changes, deletes, backs up, restores, recovers and purges the namespace's own secrets only; lists nothing |
The namespace's edit group (D51) |
Custom OneK8s Key Vault Secrets Editor (<resource group>): setSecret, update, readMetadata |
Creates and changes the namespace's own secrets and reads their attributes, by name - never a value; no delete, purge or restore; lists nothing |
The platform viewers (shared/ platform_viewer_group_object_ids) |
Custom OneK8s Platform Viewer (<resource group>), defined and assigned at the resource group |
Lists every secret's name and attributes, never a value; lists the clusters' namespaces |
key_vault_admin_group_object_ids (shared/) |
Key Vault Administrator |
None: the whole vault, certificates included |
In the cluster, each namespace with a share has a key-vault service account - created by the Flux
repository - and a SecretStore naming it. External Secrets Operator has no Azure identity of its
own: it requests a token for that service account on every read, so a namespace's store reads that
namespace's secrets and no others, and a namespace's writer can put a secret in the vault for it
without anyone else's help.
az keyvault secret set --vault-name <key_vault_name> --name example--api-key --value ...- Soft multi-tenancy: no namespace sees another's secret names. Reading metadata is under the
name condition too, and Key Vault evaluates a condition on a list call as a whole rather than
secret by secret - the collection has no name - so a list is refused to every namespace identity
and group: each reads and writes its own secrets by name (
az keyvault secret show/set --name <namespace>--...), which is all External Secrets Operator does. AnExternalSecretcannotfindby pattern. Tools that browse the vault, the Azure portal among them, need the platform viewers' role, which lists every name - so keep secrets out of the names. The same pattern - one shared instance, a data-plane role per namespace scoped by a name or an inner scope - applies to other PaaS services; see OneK8s design section 6. - A namespace name with
--in it is refused, since its prefix would overlap another's:team--a--xstarts withteam--. - Certificates are imported by an admin group. Conditions cover secret operations only, so a namespace's writers manage secrets; a certificate's private key is read as the secret behind it, under the same name, so the namespace's identity reads its own certificates as well.
- Key Vault ABAC is in preview.
- The vaults take no public network access (design D60): their private endpoints are in the environment network, and everything reaches them through the hub (the labfw VPN in the lab).
An environment can run more than one cluster on the same shared resources, so that a workload can
move from one cluster to another - which is how a cluster is replaced rather than upgraded in place:
build the next one beside it, move the workloads over, destroy the old one. In dev the clusters
(aks-dev-int-stateless-az3, and aks-dev-int-stateful when deployed) and what they share are in one
resource group, rg-aks-dev, in sub-aks-dev of the
landing zone, behind the hub's labfw (shared/ hub).
They are the internal exposure's: the design keeps internal and external workloads in separate
subscriptions and clusters (decision D52), with the countries as isolation zones inside them - a zone is
defined for the environment (its vault, DNS and certificate) and run by the cells whose tfvars name it.
sub-aks-dev plays sub-aks-dev-int; an external subscription would run shared/ and the same cluster
configuration once more with exposure = "ext" and the external zones. The one exception is the public zone onek8s.lol, which is created once with
the Azure CLI in rg-onek8s-dns, outside every state, so that its name servers - which the registrar
points at - outlive any rebuild.
The shared resources are a Terraform stack of their own, shared/, with a state of its
own. Neither cluster's configuration creates them, so either cluster can be destroyed and built again
while they stay. shared/ is applied first; the clusters look its resources up by name.
Shared - shared/envs/dev.tfvars |
Per cluster - envs/dev-<cluster>.tfvars |
|
|---|---|---|
| Resource group and networks | rg-aks-dev; per cell vnet-dev-int-stateless-az<N> (cells): address_space in /24 slots - snet-system and per isolation zone (isolation_zones) snet-<zone>-nodes and snet-<zone>-ilb - and pod_address_space, a /16 of 100.64.0.0/10 with a /20 per slot - snet-system-pods, snet-<zone>-pods, delegated to AKS - each behind its own NSG, VNet encryption on; vnet-aks-dev for the stateful cluster |
Looked up: resource_group_name, virtual_network_name, node_subnet_name, pod_subnet_name, isolation_zones |
| Key Vaults | The platform vault kv-onek8s-gwc-platform (purge protection, for the customer-managed keys) and one per enabled zone, kv-onek8s-gwc-<zone> - both named by the naming policy unless key_vault_name / zone_key_vault_names name them - with every grant on them: the admin groups' Key Vault Administrator, the namespaces' writers and groups |
Looked up: key_vault_name, customer_managed_keys - the cluster's own keys are created in the platform vault |
| Exposure | exposure: int in dev - every zone, vault and cell of the stack is of one exposure (OneK8s decision D52: internal and external workloads have a subscription and clusters each); only an internal stack has internal_dns_zones (private, linked to every cell's network) |
exposure: the cluster's zones and managed namespaces are of it; only an internal cluster names internal_dns_zone_names, on which external-dns is granted |
| What a namespace reads the vault as | id-gwc-dev-shared-kv-<namespace>, one per namespace, with its read access to its own share |
A federated credential named aks-<cluster> on each, for the namespace's key-vault service account |
| DNS zone | onek8s.lol, public, looked up in rg-onek8s-dns (dns_zone_create = false, dns_zone_private = false). A private zone would be created here and linked to vnet-aks-dev |
Looked up: dns_zone_name. App Routing's managed external-dns runs as id-gwc-dev-aks-<cluster>-dns, granted on the zone |
| Disks of persistent volumes | Created in rg-aks-dev by whichever cluster's Azure Disk CSI driver the claim is made in, for the platform's portable-disk StorageClass |
portable_disks_enabled: the cluster identity's role Portable disks (aks-dev-int-stateful) on the group, for disks and snapshots only. The stateless clusters - persistent_storage_enabled = false, no CSI drivers - have none |
| Container registry | acronek8sdev (container_registry_name): the images, which the registry builds itself with ACR tasks from the apps' public repositories at a pinned commit (container_registry_builds, such as aks-hello:0.2.0 from github.com/onek8s/aks-hello) - nobody pushes, and no app repository holds an Azure credential. Not part of the landing zone. The tier follows the environment (container_registry_sku, design D62): Premium with a private endpoint and no public network access in prd, Basic on its public endpoint (Entra ID only) everywhere else - Azure offers private endpoints on Premium alone |
Looked up: container_registry_name. AcrPull for the kubelet identity, so pods need no image pull secret |
| The cluster | aks-dev-<cluster>, run by id-gwc-dev-aks-<cluster>; its node resource group, which AKS deletes with it |
The names say which is which: a shared resource carries shared - or, for the zones, the
environment's domain - and a cluster's carries the cluster's name. The shared identities' names are
worked out the same way by both stacks, in modules/conventions, which also
holds the naming policy, the region codes and the ABAC conditions that draw each
namespace's share of the vault.
- A namespace is the same identity in every cluster. Its client ID and its grants - including anything granted to it outside this repository - follow it to the next cluster. Azure allows 20 federated credentials on an identity, so 20 clusters at once.
- Every namespace with a share of the vault in a cluster has to be listed in
shared/'skey_vault_namespaces, or its identity is not there to look up and the cluster's plan fails. The namespaces' writers are listed there too, rather than taken from the clusters' namespace grants. - Disks outlive the cluster. The Azure Disk CSI driver needs a grant outside the node resource
group to create a disk there, which Microsoft documents as
Contributor. In a group holding the other cluster too, that would let one cluster change the other, so each cluster gets a role of its own instead:Microsoft.Compute/disks/*,Microsoft.Compute/snapshots/*and reading the group. Attaching a disk is a write on the node's VM, which AKS has granted already. - Hostnames are each cluster's, in the shared zones: the clusters publish under names of their own, so they never contend for a record.
Moving a workload between the clusters - its secrets, its volumes, its hostnames - is described in aks-fluxcd-platform's README, "Moving a workload to another cluster".
The names of what these stacks create come from a naming policy (naming, in
modules/conventions): one template per resource type, filled in from the
location, the exposure, the environment and what tells the resource from the others of
its type. Its defaults are the lab's names, so the lab's tfvars name almost nothing:
| Type | Default template | The lab's (dev, int, germanywestcentral) |
|---|---|---|
resource_group |
rg-aks-{environment} |
rg-aks-dev |
key_vault |
kv-onek8s-{location_code}-{name} |
kv-onek8s-gwc-platform, kv-onek8s-gwc-int-se |
container_registry |
acronek8s{environment} |
acronek8sdev |
log_analytics_workspace |
log-{environment}-{name} |
log-dev-platform |
user_assigned_identity |
id-{location_code}-{environment}-{name} |
id-gwc-dev-shared-kv-int-se-example, id-gwc-dev-aks-int-stateless-az3 |
virtual_network, network_security_group, route_table |
vnet-{name}, nsg-{name}, rt-{name} |
vnet-dev-int-stateless-az3, nsg-dev-int-stateless-az3-int-se-nodes, rt-dev-int-stateless-az3 (the system pool's), rt-dev-int-stateless-az3-int-se (a zone's) |
private_endpoint, network_interface |
pe-{name}, nic-{name} |
pe-kv-onek8s-gwc-platform, nic-pe-kv-onek8s-gwc-platform |
disk_encryption_set |
des-{name} |
des-aks-dev-int-stateless-az3 |
consumption_budget |
budget-{environment} |
budget-dev |
ai_services |
ais-onek8s-{environment}-{name} |
ais-onek8s-dev-agents |
The placeholders are {environment}, {exposure} (empty without one), {location},
{location_code} (the region's short code, naming.location_codes over the built-in list),
and {name}. An empty placeholder leaves no stray hyphen; a
registry name loses everything but letters and digits; every name is checked against its type's Azure
rules at plan time, and an unknown type or placeholder fails the plan (output names). A variable that
names a resource itself (resource_group_name, key_vault_name, zone_key_vault_names,
container_registry_name, log_analytics_workspace_name, ai_foundry.name) still wins, resource by
resource; a registry or workspace without a name is created only with container_registry_create /
log_analytics_workspace_create. A cluster's own name, its subnets and what a cluster looks up are
stated in its tfvars as before - the cluster stack takes the same policy for its identities and its
disk encryption set, and environment when the cluster's name does not carry it in its second segment.
A real estate's policy is not kept here. Some of these names are global - Key Vault, the registry, the AI Services subdomain - and a published convention tells anyone which name the next vault will take. Keep the policy as JSON outside Git and give it to both stacks:
{
"templates": {
"key_vault": "kv-<prefix>-{location_code}-{environment}-{name}",
"container_registry": "cr<prefix>{location_code}{environment}{exposure}"
},
"location_codes": { "germanywestcentral": "dewc" }
}- Deploy workflow: the
devenvironment's secretNAMING_POLICYholds that JSON; the run writes it tonaming.auto.tfvars.json(ignored by Git, like every tfvars file outsideenvs/) and masks the templates' fixed parts, so the plan in this public repository's log does not show them. No secret: the defaults. Renew certificate and Flux webhooks read the same secret throughscripts/policy-name.sh. - By hand:
{"naming": <the JSON>}asnaming.auto.tfvars.jsonin the stack's directory, or-var-file=a file elsewhere.
Changing a template renames what it names, and for most of these types a new name is a new resource (a vault, a network, an identity and its grants): adopt a policy before the first apply of an environment, or plan the move. The lab's other workflows (Store secret, Sign images, Lab power, the VPN action, the tests) name the lab's resources directly; an estate with its own policy points them at its names. The landing zone (onek8s/azure-landing-zone) names its own resources.
Every cell runs Azure CNI Pod Subnet with dynamic IP allocation, on Cilium: the nodes take addresses of
their pool's node subnet, the pods of its pod subnet - pod_subnet_name for the system pool
(snet-system-pods), isolation_zones.<zone>.pod_subnet_name for a zone (snet-<zone>-pods), both from
shared/'s cells.<cell>.pod_address_space - and keep them up to the hub's firewall, so it sees
which zone and which pod a flow comes from (design section 5.2). Node subnet mode is not offered.
zone_node_pools gives each zone four classic node pools per generation - <country><generation>,
...spot, ...arm, ...armspot (se1, se1spot, se1arm, se1armspot for int-se in generation 1:
AKS allows 12 characters, and the exposure is the cluster's own) - from 0 nodes in the cell's availability
zone, labelled and tainted platform/zone=<zone> (and platform/capacity=spot on the spot pools), which
the platform's placement mutations target, and labelled platform/node-generation. The cluster autoscaler
takes the priority expander; the Flux repository's infrastructure/autoscaler-priority ConfigMap puts
the spot pools (.*spot.*) first. Node auto provisioning is not used: it does not support a pod subnet
(Azure/karpenter-provider-azure issue 1351). The cluster identity gets Network Contributor on the
virtual network.
Every application of a zone shares the zone's pools until an operator moves one to pools of its own -
for its size, its noise or its licence - without a change to the application (design section 2.3).
The pools are the cell's - namespace_node_pools.<namespace> in the cell's variables names their
infix (1 to 5 characters) and their kinds - and the tenant asks for them with dedicated_node_pool: true in its catalogue file (tenants/ refuses it in a cell without the pools):
namespace_node_pools = {
int-se-example = { name = "ex", kinds = ["", "spot"] } # se2ex, se2exspot
}Each generation of the namespace's zone gets <country><generation><name><kind> beside the shared pools,
labelled and tainted platform/pool=<namespace> on top of the zone's labels and taints, in the zone's
subnets. The namespace's annotations do the rest through two admission plugins Kubernetes builds in and
AKS runs: scheduler.alpha.kubernetes.io/node-selector: platform/pool=<namespace> (PodNodeSelector)
merges the node selector into every pod created in it, scheduler.alpha.kubernetes.io/defaultTolerations
(PodTolerationRestriction) adds the toleration. Every application namespace of a zone also carries
scheduler.alpha.kubernetes.io/tolerationsWhitelist - its zone, spot, GPU, the node conditions, and its own
pool if it has one - so a pod of another namespace that tolerates the pool is refused, and a dedicated
pool runs its namespace's pods only. The running pods move when they are next created (a rollout
restart); the shared pools' node is removed by the autoscaler once it is empty. tenants/ sets the
annotations from the pools' labels it reads in each cell. Moving back is dedicated_node_pool: false,
applied with dev-tenants, then removing the pools from the cell: AKS drains and deletes the namespace's pools, and its pods land on the shared ones again.
A zone's pools can be replaced by a new generation instead of being upgraded in place (design section
3.6): nothing selects a pool by name - the applications' pods select platform/zone, which every generation
carries - so two generations of a zone run side by side. A generation is keyed by one letter or digit and
states only what differs from zone_node_pools: its zones (null: every zone), its kubernetes_version
(null: the cluster's), retiring_zones, and the settings a running pool cannot change (amd64_vm_size,
arm64_vm_size, max_pods, os_disk_type, os_disk_size_gb). Moving int-fi from generation 1 to 2,
on a new Kubernetes minor:
# 1. Pin the old generation, then move the cluster: the control plane is upgraded, generation 1 is not.
kubernetes_version = "1.37"
zone_node_pools = {
generations = {
"1" = { kubernetes_version = "1.36" }
# 2. The new generation, in int-fi only: AKS creates its four pools empty, at the cluster's version and
# the newest node image.
"2" = { zones = ["int-fi"] }
}
}
# 3. Retire generation 1 in int-fi: its pools are tainted platform/retiring=true:NoSchedule. Running
# pods stay; every new pod - a rollout, a restart, a scale-out - lands on generation 2, whose nodes the
# autoscaler adds, and the autoscaler removes generation 1's nodes as they empty.
# "1" = { kubernetes_version = "1.36", retiring_zones = ["int-fi"] }
# 4. Take int-fi out of generation 1: AKS deletes its pools and drains what is left on them,
# PodDisruptionBudgets respected.
# "1" = { kubernetes_version = "1.36", zones = ["int-se"] }Each step is one pull request and one apply; step 3 can wait as long as the application teams need, and
the way back until step 4 is to remove the taint (retiring_zones) from generation 1 and retire
generation 2. A check warns when a zone is left with no generation that takes pods. The quota must hold
both generations' nodes while they overlap. Without a second generation, a version change on
kubernetes_version upgrades the pools in place with surge, as before.
The dev stateless clusters are the design's cells. Beyond the zone node pools, they set:
| Variable | What it does | Design |
|---|---|---|
exposure |
int or ext: internal and external workloads never share a cluster (decision D52), so every zone and every managed namespace's platform/zone is of the cluster's exposure, and only an internal cluster writes the internal zones' private DNS - validated at plan. The Flux repository is told it as cluster_exposure. The dev cells are internal |
sections 3.1, 3.2 |
isolation_zones |
Each zone's node and pod subnets in the cell's network, so a zone's nodes and pods are in the zone's subnets behind the zone's NSG and route table | sections 2.1, 2.3, 2.4 |
advanced_networking |
Advanced Container Networking Services, off by default (null, design D80: the hub firewall decides egress, Cilium keeps layer 3 and 4 rules in the cluster). An object turns on Hubble (observability), FQDN network policies (advancedNetworkPolicies: FQDN) and eBPF host routing (accelerationMode: BpfVeth) - which the design does not take (section 5.1). eBPF host routing is sent in the create request - AKS refuses it for a running cluster, even one with only its own iptables rules - through the AVM module's network_profile.advanced_networking.performance input (0.8.5 and later); changing it means building the cell again. Needs Azure Linux 3.0 or Ubuntu 24.04 on every node - a check says so |
section 5.1 |
customer_managed_keys |
key-<cluster>-kms for KMS etcd encryption and key-<cluster>-disk for the disk encryption set of every node's OS disk, in the platform vault - see encryption.tf. Only at creation: a cluster built without them is built again |
section 4.2 |
default_node_pool.os_sku, encryption_at_host, ssh_access, node_taints |
Azure Linux 3.0, encryption at host (the subscription feature Microsoft.Compute/EncryptionAtHost, which the Deploy workflow registers), SSH off, and CriticalAddonsOnly so that only the platform's controllers run on the system pool - the Flux extension is told to tolerate it |
sections 2.2, 2.3, 4.2 |
kubernetes_version |
Every cell starts on 1.36; AKS never upgrades a cell on its own (the default auto_upgrade) |
section 3.5 |
internal_dns_zone_names |
The internal zones' private DNS, which an internal cell's external-dns writes | section 4.1 |
Always, on every cluster: the Secrets Store CSI driver add-on is off - secrets reach pods only as Kubernetes Secrets from External Secrets Operator (design section 2.5).
Every variable defaults to the production setting of the OneK8s design, so an acceptance or
production environment states what is its own (names, networks, zones, namespaces) and nothing
about how big or how managed the cluster is. A non-production environment that wants to spend less
turns on, by name, the cost savings below; the dev lab keeps them together in one block,
"Non-production cost savings", at the top of envs/dev-int-stateless.tfvars - with the one-node system
pool in each cell's file.
| Variable | Production default | Non-production cost saving (dev lab) | What the saving gives up |
|---|---|---|---|
sku_tier |
Standard - uptime SLA, API server scaled for load (D31) |
Free |
The control plane SLA; cost analysis. |
vertical_pod_autoscaler_enabled |
true - pod right-sizing (section 2.3) |
false |
In-place right-sizing of the applications' pods; ~2.4 GiB of requests saved. |
default_node_pool |
node_count = 2, Standard_D4ds_v5 (16 GiB), os_sku = "AzureLinux" |
node_count = 2, Standard_D4alds_v6 (8 GiB) on an ephemeral OS disk (no Premium SSD) |
Room for the VPA add-on. Two small nodes hold the platform and istiod's 1 CPU / 4 GiB (Azure/AKS#5939) only with the VPA add-on off. |
The savings depend on each other - the one 8 GiB system node holds the platform only without the VPA add-on - so going back to production means all of them: delete the block and apply; all are in-place updates.
A cluster syncs its main configuration from one public Git repository through Flux. Name the repository in the variables file:
flux_git_repository = {
url = "https://github.com/example/cluster-config"
branch = "main" # default
path = "./clusters/dev-int-stateless-az3" # default "./"
}That installs the Flux cluster extension (microsoft.flux) into flux-system, kept on the newest
minor version of the Stable release train, and creates a Flux configuration named platform that
reconciles the Kustomization at path every sync_interval_seconds (default 300; the dev
clusters read every 60) and retries a failed run at the same interval. Flux prunes what is removed from the
repository. platform runs no health checks of its own (wait = false): it applies what path
holds - in practice the cluster's own Flux Kustomizations, each waiting for its objects - and is
done, so a commit is never held back behind one of them that is unhealthy.
With flux_github_webhook = true the repository is also told about a push as it happens: the
cluster gets the platform gateway (platform in platform-gateway, public), flux-system a share
of the vault (key_vault_client_id_flux_system) to read the token shared/ keeps there as
flux-system--github-webhook-token (its own flux_github_webhook; flux_github_webhook_namespaces
puts the same token in a team namespace's share for the team's Receiver), and the Flux repository
publishes a GitHub webhook receiver that checks deliveries against it. The Flux webhooks workflow
(after every Deploy, and by hand) points each repository's webhook at every running cluster that has
it on, with the token as its secret, and deletes the rest. It needs a public entry point: behind the
hub's firewall a public load balancer cannot answer, so the dev cells - internal - leave it off and
poll every minute. GitHub delivers over HTTP/1.1, which the gateway's h2-only ALPN does not refuse
(design V29), so the receiver is the platform's one HTTP/1.1 path.
The platform Kustomization is also given the Azure facts the repository cannot know on its own, as
Flux post-build variables, so they are never copied into it by hand:
| Variable | Value |
|---|---|
key_vault_url, key_vault_url_<namespace>, key_vault_client_id_<namespace> |
The platform vault, each namespace's vault, and for each namespace with a share the identity its key-vault service account reads it as - the namespace's hyphens as underscores, key_vault_client_id_int_fi_gateway. |
dns_zone_name, dns_zone_id |
The zone of dns_zone_name, and its resource ID. |
dns_identity_client_id |
The identity App Routing's managed external-dns writes the zones as. |
cluster_exposure, internal_dns_zone_ids |
The cluster's exposure (D52) and, for an internal cluster, the internal zones' Private DNS zones as a YAML flow sequence of resource IDs in single quotes (Flux drops the source's quotes before it substitutes, so the ConfigMap keeps a string). |
image_verification_client_id, image_signing_certificate_name, image_signing_subject, container_registry_login_server |
With image_integrity_enabled: what Ratify verifies with. |
cluster_name, azure_tenant_id |
Always sent. |
A variable the cluster has no value for - those of a vault or zone that is not named - is left out rather than sent empty. They apply to what path holds itself; the repository passes them
on from there to whatever needs them. Leave flux_git_repository unset, and name no tenant
repository (below), and Flux is not installed at all.
A tenant deploys itself from a Git repository of its own - the team's - named in flux of its
catalogue file:
flux:
url: https://github.com/onek8s/aks-fluxcd-example
path: ./apps
secret_name: aks-fluxcd-example-git
cell_paths: # another path in a given cell
aks-dev-int-stateful: ./stateful
substitute: # facts its manifests may use as ${...}
zone_domain: int-se.dev.onek8s.lolThat creates a Flux configuration of the team's own, named after the namespace, namespace-scoped and
installed into the namespace itself. It reconciles path on branch (default main) every
sync_interval_seconds (default 300), retries at the same interval, prunes, and waits for what it
applied to become ready. Because it is an Azure resource of its own rather than a Kustomization
nested under platform, each team's sync status - and the error, when there is one - shows on its
own row in the portal's GitOps view of the cluster.
- The extension applies the repository as the
flux-applierservice account of that namespace and refuses references across namespaces, so a team's repository changes its own namespace and nothing else. There is notargetNamespace: the repository'skustomization.yamlsetsnamespace:for its objects itself. - A private repository is read with
secret_name, a Secret in the namespace. No credential passes through Terraform or Azure: the team syncs it with an ExternalSecret against the namespace'skey-vaultstore. - What the platform puts in every tenant - the
key-vaultservice account and SecretStore, the default service account - is one directory of the Flux repository for all of them (infrastructure/tenant), applied by the tenant's<namespace>-accessconfiguration with its values; the Cilium baseline that lets the zone's gateway in applies by the namespace's label. - The manifests may use
${zone},${cluster_name}(the cell) and the tenant'ssubstitute.
Node image patching and Kubernetes upgrades roll the system pool one node at a time by default,
which is slow on anything but a small pool. default_node_pool controls the roll:
default_node_pool = {
max_surge = "33%"
drain_timeout_minutes = 30
node_soak_duration_minutes = 5
}max_surge is the extra capacity added while upgrading, so the subscription needs quota for it.
drain_timeout_minutes bounds how long a node is allowed to take to drain - a pod with a
restrictive disruption budget can otherwise hold the upgrade indefinitely - and
node_soak_duration_minutes waits after each node comes back before the next one is drained.
- The system pool runs in one availability zone unless
default_node_pool.availability_zonesis set. Spreading it -availability_zones = ["1", "2", "3"]in a region that has them - is what raises the control plane SLA from 99.9% to 99.95% on the paid tiers, and keeps the cluster running through the loss of a datacentre. Zones can only be chosen when the pool is created; changing them later replaces it. - The
Freetier carries no uptime SLA for the control plane.sku_tier = "Standard"buys the 99.9% (or 99.95% across availability zones) financially backed SLA, raises the supported node count and is what makes cost analysis available; production clusters belong there. - Workload identity is on, together with the OIDC issuer it requires. Federate a Kubernetes
service account with an Entra ID application against the
oidc_issuer_urloutput instead of storing credentials in the cluster. - Terraform waits after creating the role assignments before creating the cluster, because Azure RBAC is eventually consistent and the cluster is otherwise regularly refused access to the subnet it is supposed to join.
- Cluster operations are given 90 minutes rather than the 30 the AzAPI provider defaults to.
Giving up on the Terraform side does not stop the deployment: Azure carries on, and the cluster is
left in
Creatingwith nothing in state pointing at it. - The cluster identity gets
Network Contributoron the whole virtual network when the zones' node pools create nodes outside the system pool's subnets, and on the system pool's node and pod subnets alone otherwise - the least privilege AKS documents for a bring-your-own network - plus the cell's route tables, which AKS joins (userDefinedRouting). - The cluster uses a user assigned identity created by this module. The identity exists because
AKS has to be granted the network before the cluster is created, which a system assigned identity
cannot be: it does not exist until the cluster does. Its name is worked out, not configured: by default
id-<region code>-<environment>-<function>(the naming policy'suser_assigned_identity), built from the cluster name and the region. A cluster name reads<what it is>-<environment>-<which one>, soaks-dev-int-statefulingermanywestcentralis run byid-gwc-dev-aks-int-stateful. The region codes are the estate's own convention rather than anything Azure defines, so they live inlocal.location_codesinmodules/conventions/main.tfand the policy'slocation_codes; a region that is listed in neither stops the plan rather than being given a guessed code. An identity cannot be renamed in place, so a name that changes replaces the identity, its principal ID and its role assignments - the replacement is built and granted before the old one goes, so the cluster is never left pointing at an identity that no longer exists. - Cluster tags are not managed here. Automation outside Terraform adjusts them, so the existing
tags are read back from Azure and passed to the module as-is. Otherwise every plan would propose
deleting them, and that update alone would make Terraform re-read every computed cluster
attribute, showing
fqdn,node_resource_group_nameandoidc_issuer_urlas(known after apply)on an unchanged cluster. - The upgrade windows are
azapi_resourceblocks inmain.tfrather than module arguments. The module always sends astartDate, Azure answers with the date the window was created, and that difference shows up as an update in every later plan. Terraform can leave the property alone only by not mentioning it.