AKS 관리 ID 사용 점검

서비스 주체 비밀정보의 운영 부담을 줄이고 클러스터와 kubelet 권한을 각각 제한하세요.

설명

AKS가 Azure 리소스를 관리할 때는 관리 ID를 사용해 서비스 주체의 비밀을 직접 교체하는 부담을 줄일 수 있습니다.

잠재적 영향

컨트롤 플레인과 노드의 kubelet은 서로 다른 작업을 수행합니다. 역할이 부족하면 클러스터 작업이나 이미지 가져오기가 실패하고, 권한이 과하면 노출 범위가 커집니다.

해결 방법

클러스터의 identity에 SystemAssigned 또는 승인된 UserAssigned ID를 설정하세요. 컨트롤 플레인과 kubelet에 필요한 역할을 각각 부여하세요. 서비스 주체에서 이전할 때는 노드 풀을 업그레이드하고 클러스터 작업과 이미지 가져오기를 확인한 뒤 기존 자격 증명을 폐기하세요.

예시

첫 번째 예제는 필수 인증 구성을 생략했습니다. AzureRM에는 관리 ID 또는 서비스 주체가 필요합니다.

변경 전

hcl
resource "azurerm_kubernetes_cluster" "example" {
  name                = "example-aks"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  dns_prefix          = "exampleaks"

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

변경 후

hcl
resource "azurerm_kubernetes_cluster" "example" {
  name                = "example-aks"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  dns_prefix          = "exampleaks"

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

  identity {
    type = "SystemAssigned"
  }
}

참조