Review private access to the AKS API server

Prepare the management path first and restrict API access to the operators who need it.

Description

For a management API reachable only from private networks, set private_cluster_enabled = true. Application LoadBalancers and Ingress have separate exposure settings.

Potential impact

Missing private connectivity can interrupt administration and deployments. A broadly accessible public API can receive connection attempts from more networks.

Remediation

Configure routing and DNS for your management network, using VPN or ExpressRoute if needed. From that network, verify that the API hostname resolves to a private address and an authenticated request succeeds. For a public API, restrict the authorized public IP ranges. Retain authentication and RBAC for either option.

Examples

The excerpts omit node pools and identity. AzureRM 5.6.0 replaces the cluster when this flag changes. To keep both running during migration, give the new cluster a separate Terraform resource and name. Verify management access, workloads and data before cutover.

Before

hcl
resource "azurerm_kubernetes_cluster" "example" {
  name                = "example-aks1"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  dns_prefix          = "exampleaks1"

  private_cluster_enabled = false
}

After

hcl
resource "azurerm_kubernetes_cluster" "example" {
  name                = "example-aks1"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  dns_prefix          = "exampleaks1"

  private_cluster_enabled = true
}

References