AKS 클러스터의 Kubernetes RBAC 설정 점검

AKS 클러스터의 Kubernetes RBAC를 활성화하고 필요한 작업만 역할과 바인딩으로 허용하세요.

설명

Kubernetes RBAC를 사용하려면 AKS 생성 시 properties.enableRBAC: true를 지정하세요. 이 플래그는 Entra 사용자의 Azure 역할로 API 접근을 제어하는 aadProfile.enableAzureRBAC와 별개입니다.

잠재적 영향

RBAC가 켜져 있어도 불필요한 관리자 역할이 남아 있으면 사용자나 서비스 계정이 다른 워크로드나 데이터에 접근할 수 있습니다.

해결 방법

현재 클러스터의 RBAC 상태와 권한을 확인하세요. 필요한 작업만 담은 Role 또는 ClusterRole을 대상에 바인딩하고 일반 사용자와 서비스 계정에서 허용·거부할 작업을 시험하세요. 비 RBAC 클러스터는 새 클러스터로 이전해야 합니다.

예시

두 예시는 관리 ID와 기본 Kubernetes 버전을 사용합니다. 노드의 adminUserName과 공개 키 sshPublicKey, 해당 리전에서 지원하는 VM 크기를 지정하세요.

변경 전

bicep
param adminUserName string
param sshPublicKey string
param nodeVmSize string = 'Standard_D2s_v3'

resource aksCluster1 'Microsoft.ContainerService/managedClusters@2024-10-01' = {
  name: 'aksCluster1'
  location: resourceGroup().location
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    dnsPrefix: 'dnsprefix'
    agentPoolProfiles: [
      {
        name: 'agentpool'
        count: 2
        vmSize: nodeVmSize
        osType: 'Linux'
        mode: 'System'
      }
    ]
    linuxProfile: {
      adminUsername: adminUserName
      ssh: {
        publicKeys: [
          {
            keyData: sshPublicKey
          }
        ]
      }
    }
  }
}

API 버전 2024-10-01에서는 새 클러스터의 RBAC가 기본으로 켜집니다. 첫 예시는 기본값을 사용하고 두 번째는 이를 명시합니다.

변경 후

bicep
param adminUserName string
param sshPublicKey string
param nodeVmSize string = 'Standard_D2s_v3'

resource aksCluster1 'Microsoft.ContainerService/managedClusters@2024-10-01' = {
  name: 'aksCluster1'
  location: resourceGroup().location
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    enableRBAC: true
    dnsPrefix: 'dnsprefix'
    agentPoolProfiles: [
      {
        name: 'agentpool'
        count: 2
        vmSize: nodeVmSize
        osType: 'Linux'
        mode: 'System'
      }
    ]
    linuxProfile: {
      adminUsername: adminUserName
      ssh: {
        publicKeys: [
          {
            keyData: sshPublicKey
          }
        ]
      }
    }
  }
}

참조