Azure Arc 지원 Kubernetes의 사용자 지정 위치 만들기 및 관리

사용자 지정 위치 기능은 Azure Arc 지원 Kubernetes 클러스터를 Azure 제품의 인스턴스를 배포하기 위한 대상 위치로 구성하는 방법을 제공합니다. 사용자 지정 위치에서 배포할 수 있는 Azure 제품의 예로는 Azure Arc 지원 SQL Managed Instance 및 Azure Arc 지원 PostgreSQL 서버와 같은 데이터베이스나 App Services, Functions, Event Grid, Logic Apps 및 API Management 같은 애플리케이션 인스턴스가 있습니다.

사용자 지정 위치 Azure Arc 지원 Kubernetes 클러스터 내의 네임스페이스에 대한 일대일 매핑이 있습니다. Azure RBAC(Azure 역할 기반 액세스 제어)와 결합된 사용자 지정 위치 Azure 리소스를 사용하여 애플리케이션 개발자 또는 데이터베이스 관리자에게 세분화된 권한을 부여하여 다중 테넌트 환경에서 Arc 지원 Kubernetes 클러스터 위에 데이터베이스 또는 애플리케이션 인스턴스와 같은 리소스를 배포할 수 있습니다.

이 문서에서는 Arc 지원 Kubernetes 클러스터에서 사용자 지정 위치를 사용하도록 설정하는 방법과 사용자 지정 위치를 만드는 방법을 알아봅니다.

필수 조건

  • Azure CLI를 설치하거나 최신 버전으로 업그레이드합니다.

  • 다음 Azure CLI 확장의 최신 버전을 설치합니다.

    • connectedk8s

    • k8s-extension

    • customlocation

      az extension add --name connectedk8s
      az extension add --name k8s-extension
      az extension add --name customlocation
      

      connectedk8s, k8s-extensioncustomlocation 확장을 이미 설치한 경우 다음 명령을 사용하여 최신 버전으로 업데이트할 수 있습니다.

      az extension update --name connectedk8s
      az extension update --name k8s-extension
      az extension update --name customlocation
      
  • Microsoft.ExtendedLocation에 대한 완료된 공급자 등록을 확인합니다.

    1. 다음 명령을 입력합니다.

      az provider register --namespace Microsoft.ExtendedLocation
      
    2. 등록 프로세스를 모니터링합니다. 등록은 10분 정도 걸릴 수 있습니다.

      az provider show -n Microsoft.ExtendedLocation -o table
      

      등록된 후에는 RegistrationState 상태가 Registered 값을 가지게 됩니다.

  • 기존 Azure Arc 지원 Kubernetes 연결된 클러스터가 있는지 확인하고 최신 버전으로 에이전트를 업그레이드할 수 있습니다. 이 문서에 설명된 명령을 실행할 컴퓨터에 이 클러스터를 가리키는 kubeconfig 파일이 있는지 확인합니다.

클러스터에서 사용자 지정 위치 사용

사용자 지정 위치 기능은 클러스터 연결 기능에 따라 달라집니다. 사용자 지정 위치가 작동하려면 클러스터에서 두 기능을 모두 사용하도록 설정해야 합니다.

Azure CLI에 Microsoft Entra 사용자로 로그인한 경우 다음 명령을 사용합니다.

az connectedk8s enable-features -n <clusterName> -g <resourceGroupName> --features cluster-connect custom-locations

서비스 주체를 사용하여 Azure CLI에 로그인하는 동안 위의 명령을 실행하는 경우 다음 경고가 표시될 수 있습니다.

Unable to fetch oid of 'custom-locations' app. Proceeding without enabling the feature. Insufficient privileges to complete the operation.

서비스 주체에 Azure Arc 서비스에서 사용하는 애플리케이션의 정보를 가져올 수 있는 권한이 없기 때문입니다. 이 오류를 방지하려면 다음 단계를 완료합니다.

  1. 사용자 계정을 사용하여 Azure CLI에 로그인합니다. 다음 명령을 사용하여 Azure Arc 서비스에서 사용하는 Microsoft Entra 애플리케이션의 objectId 또는 id을(를) 가져옵니다.

    az ad sp show --id bc313c14-388c-4e7d-a58e-70017303ee3b --query id -o tsv
    
  2. 서비스 주체를 사용하여 Azure CLI에 로그인합니다. 이전 단계의 <objectId> 또는 id 값을 사용하여 클러스터에서 사용자 지정 위치를 사용하도록 설정합니다.

    az connectedk8s enable-features -n <cluster-name> -g <resource-group-name> --custom-locations-oid <objectId/id> --features cluster-connect custom-locations
    

사용자 지정 위치 만들기

  1. 클러스터에 설치하려는 Azure 서비스 인스턴스의 Azure 서비스 클러스터 확장을 배포합니다.

  2. 이후 단계에서 connectedClusterId로 참조되는 Azure Arc 지원 Kubernetes 클러스터의 Azure Resource Manager 식별자를 가져옵니다.

    az connectedk8s show -n <clusterName> -g <resourceGroupName>  --query id -o tsv
    
  3. 이후 단계에서 extensionId(으)로 참조된 Azure Arc 지원 Kubernetes 클러스터에 배포한 클러스터 확장의 Azure Resource Manager 식별자를 가져옵니다.

    az k8s-extension show --name <extensionInstanceName> --cluster-type connectedClusters -c <clusterName> -g <resourceGroupName>  --query id -o tsv
    
  4. Azure Arc 지원 Kubernetes 클러스터 및 확장을 참조하여 사용자 지정 위치를 만듭니다.

    az customlocation create -n <customLocationName> -g <resourceGroupName> --namespace <name of namespace> --host-resource-id <connectedClusterId> --cluster-extension-ids <extensionId> 
    
    • 필수 매개 변수:

      매개 변수 이름 설명
      --name, --n 사용자 지정 위치의 이름입니다.
      --resource-group, --g 사용자 지정 위치의 리소스 그룹입니다.
      --namespace 생성되는 사용자 지정 위치에 바인딩된 클러스터의 네임스페이스입니다.
      --host-resource-id Azure Arc 지원 Kubernetes 클러스터(연결된 클러스터)의 Azure Resource Manager 식별자입니다.
      --cluster-extension-ids 연결된 클러스터에 설치된 클러스터 확장 인스턴스의 Azure Resource Manager 식별자입니다. 여러 확장의 경우 클러스터 확장 ID의 공백으로 구분된 목록을 제공합니다.
    • 선택적 매개 변수:

      매개 변수 이름 설명
      --location, --l Azure에서 사용자 지정 위치 Azure Resource Manager 리소스의 위치입니다. 지정하지 않으면 연결된 클러스터의 위치가 사용됩니다.
      --tags key[=value] 형식의 공백으로 구분된 태그 목록입니다. 기존 태그를 지우려면 ''를 사용합니다.
      --kubeconfig 클러스터의 관리자 kubeconfig.

사용자 지정 위치의 세부 정보 표시

사용자 지정 위치의 세부 정보를 표시하려면 다음 명령을 사용합니다.

az customlocation show -n <customLocationName> -g <resourceGroupName> 

사용자 지정 위치 나열

리소스 그룹의 모든 사용자 지정 위치를 나열하려면 다음 명령을 사용합니다.

az customlocation list -g <resourceGroupName> 

사용자 지정 위치 만들기

update 명령을 사용하여 태그 및 연결된 클러스터 확장에 대한 기존 값을 유지하면서 --tags에 대한 새 값을 추가하거나 새 --cluster-extension-ids 사용자 지정 위치에 연결합니다.

az customlocation update -n <customLocationName> -g <resourceGroupName> --namespace <name of namespace> --host-resource-id <connectedClusterId> --cluster-extension-ids <extensionIds> 

사용자 지정 위치 패치

patch 명령을 사용하여 --cluster-extension-ids 또는 --tags 기존 값을 대체합니다. 이전 값은 유지되지 않습니다.

az customlocation patch -n <customLocationName> -g <resourceGroupName> --namespace <name of namespace> --host-resource-id <connectedClusterId> --cluster-extension-ids <extensionIds> 

사용자 지정 위치 삭제

사용자 지정 위치를 삭제하려면 다음 명령을 사용합니다.

az customlocation delete -n <customLocationName> -g <resourceGroupName> 

문제 해결

오류 Unknown proxy error occurred 사용자 지정 위치 만들기에 실패하는 경우 azure-arc 네임스페이스 내에서 Pod 간 내부 통신을 허용하도록 네트워크 정책을 수정합니다. 또한 구성된 정책에 대한 프록시 제외 없음 목록의 일부로 azure-arc 네임스페이스를 추가해야 합니다.

다음 단계