Review customer-managed keys for AKS disks

Use supported disk encryption settings when the organization requires customer-managed keys.

Description

AKS managed OS disks use platform-managed keys by default. To use a customer-managed key for node OS disks, set disk_encryption_set_id when creating the cluster.

Potential impact

If the Disk Encryption Set loses access to the key, nodes and workloads may become unavailable.

Remediation

Verify support for the node pool and disk type, key permissions, and the key rotation and recovery process. For an existing cluster, use a separate cluster name and Terraform resource, migrate the data and workloads, and verify them before cutover. Ephemeral OS disks also require a node replacement or upgrade plan for key rotation.

Examples

The excerpts use the same name for a one-node cluster. Grant the AKS cluster identity read access to a Disk Encryption Set in the same region, and give the set’s identity permission to use the Key Vault key. Check which set the deployed cluster references.

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"

  default_node_pool {
    name       = "default"
    node_count = 1
    vm_size    = "Standard_D2_v2"
  }
}

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"
  disk_encryption_set_id = azurerm_disk_encryption_set.example.id

  default_node_pool {
    name       = "default"
    node_count = 1
    vm_size    = "Standard_D2_v2"
  }
}

References