Azure 서비스 주체(Service Principal) 인증 공급자
azureServicePrincipal 인증 공급자는 지원되는 Azure 스케일러가 액세스 토큰을 획득할 때 사용할 Microsoft Entra 서비스 주체 자격 증명을 만들어 줍니다. TriggerAuthentication이나 ClusterTriggerAuthentication에서 설정할 수 있고, 여러 스케일링 트리거에서 재사용할 수 있습니다.
Azure Pipelines 스케일러는 KEDA 2.21부터 이 공급자를 지원합니다.
출처: 문서
본문
Parameters
- tenantId - Microsoft Entra 테넌트 ID. (필수)
- clientId - 서비스 주체의 애플리케이션(클라이언트) ID. (필수)
- clientSecret - 클라이언트 시크릿을 담고 있는 Kubernetes Secret에 대한 참조. (선택, clientCertificate와 상호 배타적)
- clientCertificate - 클라이언트 인증서와 개인 키를 담고 있는 Kubernetes Secret에 대한 참조. (선택, clientSecret와 상호 배타적)
- clientCertificatePassword - PKCS#12 인증서의 암호를 담고 있는 Kubernetes Secret에 대한 참조. (선택, clientCertificate가 필요)
- cloud - Azure 클라우드 환경. KEDA 내장 클라우드 이름과 AZURE_ENVIRONMENT_FILEPATH를 통해 로드한 환경이 지원됩니다. (기본값: AzurePublicCloud, 선택)
- activeDirectoryEndpoint - Microsoft Entra 기관(authority) 엔드포인트. (선택, cloud가 Private일 때 필수이며, 다른 클라우드에서는 설정하면 안 됩니다)
clientSecret 또는 clientCertificate 중 정확히 하나만 설정해야 합니다.
클라이언트 시크릿 인증 (Client secret authentication)
서비스 주체 클라이언트 시크릿을 담은 Kubernetes Secret을 생성합니다:
apiVersion: v1
kind: Secret
metadata:
name: azure-service-principal
namespace: default
type: Opaque
data:
clientSecret: <base64-encoded-client-secret>
인증 공급자에서 이를 참조합니다:
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: azure-service-principal
namespace: default
spec:
azureServicePrincipal:
tenantId: <tenant-id>
clientId: <client-id>
clientSecret:
valueFrom:
secretKeyRef:
name: azure-service-principal
key: clientSecret
클라이언트 인증서 인증 (Client certificate authentication)
인증서 Secret은 다음 중 하나를 담고 있어야 합니다:
- 인증서와 개인 키가 포함된 암호화되지 않은 PEM 번들.
- PKCS#12/PFX 인증서. 암호로 보호되어 있다면 clientCertificatePassword를 설정해야 합니다.
암호화된 PEM 개인 키는 지원되지 않습니다. 암호가 필요한 인증서 인증에는 PKCS#12/PFX를 사용하세요.
apiVersion: v1
kind: Secret
metadata:
name: azure-service-principal-certificate
namespace: default
type: Opaque
data:
clientCertificate: <base64-encoded-PEM-or-PFX>
clientCertificatePassword: <base64-encoded-password>
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: azure-service-principal-certificate
namespace: default
spec:
azureServicePrincipal:
tenantId: <tenant-id>
clientId: <client-id>
clientCertificate:
valueFrom:
secretKeyRef:
name: azure-service-principal-certificate
key: clientCertificate
clientCertificatePassword:
valueFrom:
secretKeyRef:
name: azure-service-principal-certificate
key: clientCertificatePassword
암호화되지 않은 PEM 인증서를 사용한다면 clientCertificatePassword와 해당 Secret 키를 모두 생략하세요.
Azure 클라우드 환경 (Azure cloud environments)
cloud를 생략하면 Azure 공용 클라우드(Azure Public Cloud)가 사용됩니다. 내장 환경에는 AzurePublicCloud, AzureUSGovernmentCloud, AzureChinaCloud가 있습니다. AzureGermanCloud는 레거시 구성과의 호환성을 위해 계속 허용되지만, Microsoft Cloud Germany는 2021년 10월 29일에 종료되었으므로 새 배포에는 사용하면 안 됩니다. AZURE_ENVIRONMENT_FILEPATH가 해당 이름을 정의하는 Azure 환경 파일을 가리키면 AzureStackCloud를 사용할 수 있습니다. 프라이빗 클라우드의 경우 cloud를 Private으로 설정하고 해당 Microsoft Entra 기관 엔드포인트를 제공하세요:
azureServicePrincipal:
tenantId: <tenant-id>
clientId: <client-id>
cloud: Private
activeDirectoryEndpoint: https://login.private.example.com/
clientSecret:
valueFrom:
secretKeyRef:
name: azure-service-principal
key: clientSecret
KEDA는 프라이빗 클라우드 서비스 주체 자격 증명에 대해 Microsoft Entra 인스턴스 검색(instance discovery)을 비활성화합니다. 실제로 사용하는 스케일러가 Azure 서비스 엔드포인트와 토큰 범위를 선택하는 역할은 그대로 담당합니다.
더 알아보기 (Learn more)
이상으로 azureServicePrincipal 인증 공급자를 구성하는 방법을 알아봤어요. 클라이언트 시크릿 방식과 클라이언트 인증서 방식을 구분해서 기억해 두시고, 클라우드 환경별로 맞는 엔드포인트를 설정해 주세요.