Kubernetes@1 - Kubectl v1 작업

kubectl 명령을 실행하여 Azure Container Service에서 Kubernetes 클러스터를 배포, 구성, 업데이트합니다.

kubectl 명령을 실행하여 Azure Container Service에서 Kubernetes 클러스터를 배포, 구성, 업데이트합니다.

Syntax

# Kubectl v1
# Deploy, configure, update a Kubernetes cluster in Azure Container Service by running kubectl commands.
- task: Kubernetes@1
  inputs:
  # Kubernetes Cluster
    #connectionType: 'Kubernetes Service Connection' # 'Azure Resource Manager' | 'Kubernetes Service Connection' | 'None'. Required when command != logout. Service connection type. Default: Kubernetes Service Connection.
    #kubernetesServiceEndpoint: # string. Required when connectionType = Kubernetes Service Connection && command != logout. Kubernetes service connection. 
    #azureSubscriptionEndpoint: # string. Required when connectionType = Azure Resource Manager && command != logout. Azure subscription. 
    #azureResourceGroup: # string. Required when connectionType = Azure Resource Manager && command != logout. Resource group. 
    #kubernetesCluster: # string. Required when connectionType = Azure Resource Manager && command != logout. Kubernetes cluster. 
    #useClusterAdmin: false # boolean. Optional. Use when connectionType = Azure Resource Manager && command != logout. Use cluster admin credentials. Default: false.
    #namespace: # string. Optional. Use when command != logout. Namespace. 
  # Commands
    #command: # 'apply' | 'create' | 'delete' | 'exec' | 'expose' | 'get' | 'login' | 'logout' | 'logs' | 'run' | 'set' | 'top'. Command. 
    #useConfigurationFile: false # boolean. Optional. Use when command != login && command != logout. Use configuration. Default: false.
    #configurationType: 'configuration' # 'configuration' | 'inline'. Optional. Use when useConfigurationFile = true. Configuration type. Default: configuration.
    configuration: # string. Required when configurationType = configuration. File path. 
    #inline: # string. Required when configurationType = inline. Inline configuration. 
    #arguments: # string. Optional. Use when command != login && command != logout. Arguments. 
  # Secrets
    #secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required when command != login && command != logout. Type of secret. Default: dockerRegistry.
    #secretArguments: # string. Optional. Use when secretType = generic && command != login && command != logout. Arguments. 
    #containerRegistryType: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required when secretType = dockerRegistry && command != login && command != logout. Container registry type. Default: Azure Container Registry.
    #dockerRegistryEndpoint: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Container Registry && command != login && command != logout. Docker registry service connection. 
    #azureSubscriptionEndpointForSecrets: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry && command != login && command != logout. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry && command != login && command != logout. Azure container registry. 
    #secretName: # string. Optional. Use when command != login && command != logout. Secret name. 
    #forceUpdate: true # boolean. Optional. Use when command != login && command != logout. Force update secret. Default: true.
  # ConfigMaps
    #configMapName: # string. Optional. Use when command != login && command != logout. ConfigMap name. 
    #forceUpdateConfigMap: false # boolean. Optional. Use when command != login && command != logout. Force update configmap. Default: false.
    #useConfigMapFile: false # boolean. Optional. Use when command != login && command != logout. Use file. Default: false.
    #configMapFile: # string. Required when useConfigMapFile = true && command != login && command != logout. ConfigMap file. 
    #configMapArguments: # string. Optional. Use when useConfigMapFile = false && command != login && command != logout. Arguments. 
  # Advanced
    #versionOrLocation: 'version' # 'version' | 'location'. Kubectl. Default: version.
    #versionSpec: '1.13.2' # string. Optional. Use when versionOrLocation = version. Version spec. Default: 1.13.2.
    #checkLatest: false # boolean. Optional. Use when versionOrLocation = version. Check for latest version. Default: false.
    #specifyLocation: # string. Required when versionOrLocation = location. Path to kubectl. 
    #workingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd. Working directory. Default: $(System.DefaultWorkingDirectory).
    #outputFormat: 'json' # 'json' | 'yaml' | 'none'. Output format. Default: json.
# Kubectl v1
# Deploy, configure, update a Kubernetes cluster in Azure Container Service by running kubectl commands.
- task: Kubernetes@1
  inputs:
  # Kubernetes Cluster
    #connectionType: 'Kubernetes Service Connection' # 'Azure Resource Manager' | 'Kubernetes Service Connection' | 'None'. Required when command != logout. Service connection type. Default: Kubernetes Service Connection.
    #kubernetesServiceEndpoint: # string. Required when connectionType = Kubernetes Service Connection && command != logout. Kubernetes service connection. 
    #azureSubscriptionEndpoint: # string. Required when connectionType = Azure Resource Manager && command != logout. Azure subscription. 
    #azureResourceGroup: # string. Required when connectionType = Azure Resource Manager && command != logout. Resource group. 
    #kubernetesCluster: # string. Required when connectionType = Azure Resource Manager && command != logout. Kubernetes cluster. 
    #useClusterAdmin: false # boolean. Optional. Use when connectionType = Azure Resource Manager && command != logout. Use cluster admin credentials. Default: false.
    #namespace: # string. Optional. Use when command != logout. Namespace. 
  # Commands
    #command: # 'apply' | 'create' | 'delete' | 'exec' | 'expose' | 'get' | 'login' | 'logout' | 'logs' | 'run' | 'set' | 'top'. Command. 
    #useConfigurationFile: false # boolean. Optional. Use when command != login && command != logout. Use configuration. Default: false.
    #configurationType: 'configuration' # 'configuration' | 'inline'. Optional. Use when useConfigurationFile = true. Configuration type. Default: configuration.
    configuration: # string. Required when configurationType = configuration. File path. 
    #inline: # string. Required when configurationType = inline. Inline configuration. 
    #arguments: # string. Optional. Use when command != login && command != logout. Arguments. 
  # Secrets
    #secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required when command != login && command != logout. Type of secret. Default: dockerRegistry.
    #secretArguments: # string. Optional. Use when secretType = generic && command != login && command != logout. Arguments. 
    #containerRegistryType: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required when secretType = dockerRegistry && command != login && command != logout. Container registry type. Default: Azure Container Registry.
    #dockerRegistryEndpoint: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Container Registry && command != login && command != logout. Docker registry service connection. 
    #azureSubscriptionEndpointForSecrets: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry && command != login && command != logout. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry && command != login && command != logout. Azure container registry. 
    #secretName: # string. Optional. Use when command != login && command != logout. Secret name. 
    #forceUpdate: true # boolean. Optional. Use when command != login && command != logout. Force update secret. Default: true.
  # ConfigMaps
    #configMapName: # string. Optional. Use when command != login && command != logout. ConfigMap name. 
    #forceUpdateConfigMap: false # boolean. Optional. Use when command != login && command != logout. Force update configmap. Default: false.
    #useConfigMapFile: false # boolean. Optional. Use when command != login && command != logout. Use file. Default: false.
    #configMapFile: # string. Required when useConfigMapFile = true && command != login && command != logout. ConfigMap file. 
    #configMapArguments: # string. Optional. Use when useConfigMapFile = false && command != login && command != logout. Arguments. 
  # Advanced
    #versionOrLocation: 'version' # 'version' | 'location'. Kubectl. Default: version.
    #versionSpec: '1.13.2' # string. Optional. Use when versionOrLocation = version. Version spec. Default: 1.13.2.
    #checkLatest: false # boolean. Optional. Use when versionOrLocation = version. Check for latest version. Default: false.
    #specifyLocation: # string. Required when versionOrLocation = location. Path to kubectl. 
    #workingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd. Working directory. Default: $(System.DefaultWorkingDirectory).
    #outputFormat: 'json' # 'json' | 'yaml'. Output format. Default: json.
# Deploy to Kubernetes v1
# Deploy, configure, update a Kubernetes cluster in Azure Container Service by running kubectl commands.
- task: Kubernetes@1
  inputs:
  # Kubernetes Cluster
    #connectionType: 'Kubernetes Service Connection' # 'Azure Resource Manager' | 'Kubernetes Service Connection' | 'None'. Required when command != logout. Service connection type. Default: Kubernetes Service Connection.
    #kubernetesServiceEndpoint: # string. Required when connectionType = Kubernetes Service Connection && command != logout. Kubernetes service connection. 
    #azureSubscriptionEndpoint: # string. Required when connectionType = Azure Resource Manager && command != logout. Azure subscription. 
    #azureResourceGroup: # string. Required when connectionType = Azure Resource Manager && command != logout. Resource group. 
    #kubernetesCluster: # string. Required when connectionType = Azure Resource Manager && command != logout. Kubernetes cluster. 
    #useClusterAdmin: false # boolean. Optional. Use when connectionType = Azure Resource Manager && command != logout. Use cluster admin credentials. Default: false.
    #namespace: # string. Optional. Use when command != logout. Namespace. 
  # Commands
    #command: # 'apply' | 'create' | 'delete' | 'exec' | 'expose' | 'get' | 'login' | 'logout' | 'logs' | 'run' | 'set' | 'top'. Command. 
    #useConfigurationFile: false # boolean. Optional. Use when command != login && command != logout. Use configuration. Default: false.
    #configurationType: 'configuration' # 'configuration' | 'inline'. Optional. Use when useConfigurationFile = true. Configuration type. Default: configuration.
    configuration: # string. Required when configurationType = configuration. File path. 
    #inline: # string. Required when configurationType = inline. Inline configuration. 
    #arguments: # string. Optional. Use when command != login && command != logout. Arguments. 
  # Secrets
    #secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required when command != login && command != logout. Type of secret. Default: dockerRegistry.
    #secretArguments: # string. Optional. Use when secretType = generic && command != login && command != logout. Arguments. 
    #containerRegistryType: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required when secretType = dockerRegistry && command != login && command != logout. Container registry type. Default: Azure Container Registry.
    #dockerRegistryEndpoint: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Container Registry && command != login && command != logout. Docker registry service connection. 
    #azureSubscriptionEndpointForSecrets: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry && command != login && command != logout. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry && command != login && command != logout. Azure container registry. 
    #secretName: # string. Optional. Use when command != login && command != logout. Secret name. 
    #forceUpdate: true # boolean. Optional. Use when command != login && command != logout. Force update secret. Default: true.
  # ConfigMaps
    #configMapName: # string. Optional. Use when command != login && command != logout. ConfigMap name. 
    #forceUpdateConfigMap: false # boolean. Optional. Use when command != login && command != logout. Force update configmap. Default: false.
    #useConfigMapFile: false # boolean. Optional. Use when command != login && command != logout. Use file. Default: false.
    #configMapFile: # string. Required when useConfigMapFile = true && command != login && command != logout. ConfigMap file. 
    #configMapArguments: # string. Optional. Use when useConfigMapFile = false && command != login && command != logout. Arguments. 
  # Advanced
    #versionOrLocation: 'version' # 'version' | 'location'. Kubectl. Default: version.
    #versionSpec: '1.13.2' # string. Optional. Use when versionOrLocation = version. Version spec. Default: 1.13.2.
    #checkLatest: false # boolean. Optional. Use when versionOrLocation = version. Check for latest version. Default: false.
    #specifyLocation: # string. Required when versionOrLocation = location. Path to kubectl. 
    #workingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd. Working directory. Default: $(System.DefaultWorkingDirectory).
    #outputFormat: 'json' # 'json' | 'yaml'. Output format. Default: json.
# Deploy to Kubernetes v1
# Deploy, configure, update your Kubernetes cluster in Azure Container Service by running kubectl commands.
- task: Kubernetes@1
  inputs:
  # Kubernetes Cluster
    #connectionType: 'Azure Resource Manager' # 'Azure Resource Manager' | 'Kubernetes Service Connection' | 'None'. Required when command != logout. Service connection type. Default: Azure Resource Manager.
    #kubernetesServiceEndpoint: # string. Required when connectionType = Kubernetes Service Connection && command != logout. Kubernetes service connection. 
    #azureSubscriptionEndpoint: # string. Required when connectionType = Azure Resource Manager && command != logout. Azure subscription. 
    #azureResourceGroup: # string. Required when connectionType = Azure Resource Manager && command != logout. Resource group. 
    #kubernetesCluster: # string. Required when connectionType = Azure Resource Manager && command != logout. Kubernetes cluster. 
    #namespace: # string. Optional. Use when command != logout. Namespace. 
  # Commands
    command: 'apply' # 'apply' | 'create' | 'delete' | 'exec' | 'expose' | 'get' | 'login' | 'logout' | 'logs' | 'run' | 'set' | 'top'. Required. Command. Default: apply.
    #useConfigurationFile: false # boolean. Optional. Use when command != login && command != logout. Use configuration files. Default: false.
    #configuration: # string. Required when useConfigurationFile = true. Configuration file. 
    #arguments: # string. Optional. Use when command != login && command != logout. Arguments. 
  # Secrets
    #secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required when command != login && command != logout. Type of secret. Default: dockerRegistry.
    #secretArguments: # string. Optional. Use when secretType = generic && command != login && command != logout. Arguments. 
    #containerRegistryType: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required when secretType = dockerRegistry && command != login && command != logout. Container registry type. Default: Azure Container Registry.
    #dockerRegistryEndpoint: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Container Registry && command != login && command != logout. Docker registry service connection. 
    #azureSubscriptionEndpointForSecrets: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry && command != login && command != logout. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry && command != login && command != logout. Azure container registry. 
    #secretName: # string. Optional. Use when command != login && command != logout. Secret name. 
    #forceUpdate: true # boolean. Optional. Use when command != login && command != logout. Force update secret. Default: true.
  # ConfigMaps
    #configMapName: # string. Optional. Use when command != login && command != logout. ConfigMap name. 
    #forceUpdateConfigMap: false # boolean. Optional. Use when command != login && command != logout. Force update configmap. Default: false.
    #useConfigMapFile: false # boolean. Optional. Use when command != login && command != logout. Use file. Default: false.
    #configMapFile: # string. Required when useConfigMapFile = true && command != login && command != logout. ConfigMap file. 
    #configMapArguments: # string. Optional. Use when useConfigMapFile = false && command != login && command != logout. Arguments. 
  # Advanced
    #versionOrLocation: 'version' # 'version' | 'location'. Optional. Use when command != login && command != logout. Kubectl. Default: version.
    #versionSpec: '1.7.0' # string. Optional. Use when versionOrLocation = version && command != login && command != logout. Version spec. Default: 1.7.0.
    #checkLatest: false # boolean. Optional. Use when versionOrLocation = version && command != login && command != logout. Check for latest version. Default: false.
    #specifyLocation: # string. Required when versionOrLocation = location && command != login && command != logout. Path to kubectl. 
    #workingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd. Optional. Use when command != login && command != logout. Working directory. Default: $(System.DefaultWorkingDirectory).
    #outputFormat: 'json' # 'json' | 'yaml'. Optional. Use when command != login && command != logout. Output format. Default: json.

입력

connectionType - 서비스 연결 유형
string. 필요한 경우 command != logout입니다. 허용되는 값: Azure Resource Manager, Kubernetes Service Connection, None. 기본값은 Kubernetes Service Connection입니다.

다른 클러스터에 Azure Kubernetes Service 또는 Kubernetes Service Connection을 사용할 때 Azure Resource Manager 서비스 연결 유형을 지정합니다.

  • Kubernetes Service Connection- KubeConfig 파일을 제공하거나, 서비스 계정을 지정하거나, Azure 구독 옵션을 사용하여 AKS instance 가져올 수 있습니다. Azure 구독 옵션을 사용하여 AKS instance 가져오려면 서비스 연결 구성 시간에 Kubernetes 클러스터 액세스가 필요합니다.
  • Azure Resource Manager- AKS instance 선택할 수 있습니다. 서비스 연결 구성 시간에 Kubernetes 클러스터에 액세스하지 않습니다.
  • None - 로컬에 저장된 미리 만들어진 Kubernetes 구성을 사용합니다.

자세한 내용은 다음 설명 섹션의 서비스 연결을 참조 하세요 .


connectionType - 서비스 연결 유형
string. 필요한 경우 command != logout입니다. 허용되는 값: Azure Resource Manager, Kubernetes Service Connection, None. 기본값은 Azure Resource Manager입니다.

다른 클러스터에 Azure Kubernetes Service 또는 Kubernetes Service Connection을 사용할 때 Azure Resource Manager 서비스 연결 유형을 지정합니다.


kubernetesServiceEndpoint - Kubernetes 서비스 연결
string. 필요한 경우 connectionType = Kubernetes Service Connection && command != logout입니다.

Kubernetes 서비스 연결을 선택합니다.


azureSubscriptionEndpoint - Azure 구독
string. 필요한 경우 connectionType = Azure Resource Manager && command != logout입니다.

Azure Container Registry 포함하는 Azure Resource Manager 구독을 지정합니다.

참고

새 서비스 연결을 구성하려면 목록에서 Azure 구독을 지정하고 를 클릭합니다 Authorize. 구독이 목록에 없거나 기존 서비스 주체를 사용하려는 경우 또는 Manage 단추를 사용하여 Add Azure 서비스 연결을 설정할 수 있습니다.


azureResourceGroup - 리소스 그룹
string. 필요한 경우 connectionType = Azure Resource Manager && command != logout입니다.

Azure 리소스 그룹을 선택합니다.


kubernetesCluster - Kubernetes 클러스터
string. 필요한 경우 connectionType = Azure Resource Manager && command != logout입니다.

Azure 관리형 클러스터를 선택합니다.


useClusterAdmin - 클러스터 관리자 자격 증명 사용
boolean. 선택 사항입니다. 를 사용하는 경우 connectionType = Azure Resource Manager && command != logout를 사용합니다. 기본값은 false입니다.

기본 클러스터 사용자 자격 증명 대신 클러스터 관리자 자격 증명을 사용합니다.


namespace - 네임 스페이스
string. 선택 사항입니다. 를 사용하는 경우 command != logout를 사용합니다.

–namespace 플래그를 사용하여 kubectl 명령에 대한 네임스페이스를 설정합니다. 네임스페이스가 제공되지 않으면 명령은 기본 네임스페이스에서 실행됩니다.


command - 명령
string. 허용되는 값: apply, , create, delete, execexpose, get, login, logout, logs, run, , set, . top

실행할 kubectl 명령을 선택하거나 지정합니다. 허용되는 값 목록은 작업 도우미 사용할 때 쉽게 선택할 수 있는 몇 가지 일반적인 선택 항목을 제공하지만 과 같은 scale다른 kubectl 명령을 지정할 수 있습니다. 입력을 arguments 사용하여 지정된 kubectl 명령에 대한 추가 매개 변수를 지정합니다.


command - 명령
string. 필수 요소. 허용되는 값: apply, , create, delete, execexpose, get, login, logout, logs, run, , set, . top 기본값은 apply입니다.

실행할 kubectl 명령을 선택하거나 지정합니다.


useConfigurationFile - 구성 사용
boolean. 선택 사항입니다. 를 사용하는 경우 command != login && command != logout를 사용합니다. 기본값은 false입니다.

명령과 함께 사용할 Kubernetes 구성을 지정합니다 kubectl . Kubernetes 구성 파일에 대한 인라인 스크립트, 파일 이름, 디렉터리 또는 URL을 제공할 수 있습니다.


useConfigurationFile - 구성 파일 사용
boolean. 선택 사항입니다. 를 사용하는 경우 command != login && command != logout를 사용합니다. 기본값은 false입니다.

명령과 함께 사용할 Kubernetes 구성을 지정합니다 kubectl . Kubernetes 구성 파일에 대한 인라인 스크립트, 파일 이름, 디렉터리 또는 URL을 제공할 수 있습니다.


configurationType - 구성 유형
string. 선택 사항입니다. 를 사용하는 경우 useConfigurationFile = true를 사용합니다. 허용되는 값: configuration (파일 경로), inline (인라인 구성). 기본값은 configuration입니다.

명령에 대한 kubectl Kubernetes 구성 유형을 지정합니다. 파일 경로 또는 인라인 스크립트일 수 있습니다.


configuration - 파일 경로
string. 필요한 경우 configurationType = configuration입니다.

명령과 함께 사용되는 kubernetes 구성 파일에 대한 파일 이름, 디렉터리 또는 URL을 지정합니다.


configuration - 구성 파일
string. 필요한 경우 useConfigurationFile = true입니다.

명령과 함께 사용되는 kubernetes 구성 파일에 대한 파일 이름, 디렉터리 또는 URL을 지정합니다.


inline - 인라인 구성
string. 필요한 경우 configurationType = inline입니다.

명령에 대한 인라인 배포 구성을 지정합니다 kubectl .


arguments - 인수
string. 선택 사항입니다. 를 사용하는 경우 command != login && command != logout를 사용합니다.

지정된 kubectl 명령에 대한 인수입니다.


secretType - 비밀 유형
string. 필요한 경우 command != login && command != logout입니다. 허용되는 값: dockerRegistry, generic. 기본값은 dockerRegistry입니다.

제네릭 또는 docker imagepullsecret을 만들거나 업데이트합니다. dockerRegistry를 선택하여 선택한 레지스트리의 imagepullsecret을 만들거나 업데이트합니다. imagePullSecret은 컨테이너 레지스트리 암호가 포함된 비밀을 Kubelet에 전달하여 Pod를 대신하여 프라이빗 이미지를 끌어올 수 있도록 하는 방법입니다.


secretArguments - 인수
string. 선택 사항입니다. 를 사용하는 경우 secretType = generic && command != login && command != logout를 사용합니다.

비밀에 삽입할 키와 리터럴 값을 지정합니다. 예를 들어 또는 --from-literal=key2="top secret"입니다--from-literal=key1=value1.


containerRegistryType - 컨테이너 레지스트리 유형
string. 필요한 경우 secretType = dockerRegistry && command != login && command != logout입니다. 허용되는 값: Azure Container Registry, Container Registry. 기본값은 Azure Container Registry입니다.

컨테이너 레지스트리 유형을 선택합니다. 작업은 Azure 구독 세부 정보를 사용하여 Azure Container Registry로 작업할 수 있습니다. 다른 표준 컨테이너 레지스트리도 지원됩니다.


dockerRegistryEndpoint - Docker 레지스트리 서비스 연결
string. 선택 사항입니다. 을 사용할 때 secretType = dockerRegistry && containerRegistryType = Container Registry && command != login && command != logout사용합니다.

Docker 레지스트리 서비스 연결을 선택합니다. 레지스트리를 사용하여 인증해야 하는 명령에 필요합니다.


azureSubscriptionEndpointForSecrets - Azure 구독
string. 선택 사항입니다. 을 사용할 때 secretType = dockerRegistry && containerRegistryType = Azure Container Registry && command != login && command != logout사용합니다.

Azure Container Registry 포함하는 Azure Resource Manager 구독을 지정합니다.

참고

새 서비스 연결을 구성하려면 목록에서 Azure 구독을 선택하고 를 클릭합니다 Authorize. 구독이 나열되지 않았거나 기존 서비스 주체를 사용하려는 경우 또는 Manage 단추를 사용하여 Add Azure 서비스 연결을 설정할 수 있습니다.


azureContainerRegistry - Azure Container Registry
string. 선택 사항입니다. 을 사용할 때 secretType = dockerRegistry && containerRegistryType = Azure Container Registry && command != login && command != logout사용합니다.

컨테이너 이미지를 끌어와 Kubernetes 클러스터에 애플리케이션을 배포하는 데 사용되는 Azure Container Registry 지정합니다. 레지스트리를 사용하여 인증해야 하는 명령에 필요합니다.


secretName - 비밀 이름
string. 선택 사항입니다. 을 사용할 때 command != login && command != logout사용합니다.

비밀 이름입니다. Kubernetes YAML 구성 파일에서 이 비밀 이름을 사용할 수 있습니다.


forceUpdate - 강제 업데이트 비밀
boolean. 선택 사항입니다. 을 사용할 때 command != login && command != logout사용합니다. 기본값은 true입니다.

비밀이 있는 경우 삭제하고 업데이트된 값으로 새 비밀을 만듭니다.


configMapName - ConfigMap 이름
string. 선택 사항입니다. 을 사용할 때 command != login && command != logout사용합니다.

ConfigMaps를 사용하면 이미지 콘텐츠에서 구성 아티팩트 분리를 통해 컨테이너화된 애플리케이션을 이식 가능한 상태로 유지할 수 있습니다.


forceUpdateConfigMap - 강제 업데이트 구성맵
boolean. 선택 사항입니다. 을 사용할 때 command != login && command != logout사용합니다. 기본값은 false입니다.

configmap이 있는 경우 삭제하고 업데이트된 값을 사용하여 새 구성 맵을 만듭니다.


useConfigMapFile - 파일 사용
boolean. 선택 사항입니다. 을 사용할 때 command != login && command != logout사용합니다. 기본값은 false입니다.

ConfigMap 디렉터리를 지정하여 개별 파일 또는 여러 파일에서 을 만듭니다.


configMapFile - ConfigMap 파일
string. 필요한 경우 useConfigMapFile = true && command != login && command != logout입니다.

configMaps를 포함하는 파일 또는 디렉터리를 지정합니다.


configMapArguments - 인수
string. 선택 사항입니다. 을 사용할 때 useConfigMapFile = false && command != login && command != logout사용합니다.

configMap삽입할 키와 리터럴 값을 지정합니다. 예를 들어 --from-literal=key1=value1 또는 --from-literal=key2="top secret"입니다.


versionOrLocation - Kubectl
string. 허용되는 값: version, location (위치 지정). 기본값은 version입니다.

kubectl은 Kubernetes 클러스터에 대한 명령을 실행하기 위한 명령줄 인터페이스입니다.


versionOrLocation - Kubectl
string. 선택 사항입니다. 을 사용할 때 command != login && command != logout사용합니다. 허용되는 값: version, location (위치 지정). 기본값은 version입니다.

kubectl은 Kubernetes 클러스터에 대한 명령을 실행하기 위한 명령줄 인터페이스입니다.


versionSpec - 버전 사양
string. 선택 사항입니다. 을 사용할 때 versionOrLocation = version사용합니다. 기본값은 1.13.2입니다.

가져올 버전의 버전 사양을 지정합니다. 예: 1.7.0, , 1.x.04.x.0, , 6.10.0. >=6.10.0


versionSpec - 버전 사양
string. 선택 사항입니다. 을 사용할 때 versionOrLocation = version && command != login && command != logout사용합니다. 기본값은 1.7.0입니다.

-18-2 가져올 버전의 버전 사양을 지정합니다. 예: 1.7.0, , 1.x.04.x.0, , 6.10.0. >=6.10.0


checkLatest - 최신 버전 확인
boolean. 선택 사항입니다. 을 사용할 때 versionOrLocation = version사용합니다. 기본값은 false입니다.

항상 온라인으로 버전 사양을 충족하는 사용 가능한 최신 버전(stable.txt)을 확인합니다. 항상 최신 정보를 얻을 수 있는 특정 시나리오가 없는 한 일반적으로 false입니다. 이로 인해 특히 호스트된 빌드 풀에서 필요하지 않을 수 있는 경우 다운로드 비용이 발생합니다.


checkLatest - 최신 버전 확인
boolean. 선택 사항입니다. 을 사용할 때 versionOrLocation = version && command != login && command != logout사용합니다. 기본값은 false입니다.

항상 온라인으로 버전 사양을 충족하는 사용 가능한 최신 버전(stable.txt)을 확인합니다. 항상 최신 정보를 얻을 수 있는 특정 시나리오가 없는 한 일반적으로 false입니다. 이로 인해 특히 호스트된 빌드 풀에서 필요하지 않을 수 있는 경우 다운로드 비용이 발생합니다.


specifyLocation - kubectl 경로
string. 필요한 경우 versionOrLocation = location입니다.

파일의 전체 경로를 지정합니다 kubectl.exe .


specifyLocation - kubectl 경로
string. 필요한 경우 versionOrLocation = location && command != login && command != logout입니다.

파일의 전체 경로를 지정합니다 kubectl.exe .


workingDirectory - 작업 디렉터리
입력 별칭: cwd. string. 기본값은 $(System.DefaultWorkingDirectory)입니다.

Kubectl 명령에 대한 작업 디렉터리입니다.


workingDirectory - 작업 디렉터리
입력 별칭: cwd. string. 선택 사항입니다. 을 사용할 때 command != login && command != logout사용합니다. 기본값은 $(System.DefaultWorkingDirectory)입니다.

Kubectl 명령에 대한 작업 디렉터리입니다.


outputFormat - 출력 형식
string. 허용되는 값: json, yaml, none. 기본값은 json입니다.

출력 형식입니다.


outputFormat - 출력 형식
string. 허용되는 값: json, yaml. 기본값은 json입니다.

출력 형식입니다.


outputFormat - 출력 형식
string. 선택 사항입니다. 을 사용할 때 command != login && command != logout사용합니다. 허용되는 값: json, yaml. 기본값은 json입니다.

출력 형식입니다.


작업 제어 옵션

모든 작업에는 작업 입력 외에 제어 옵션이 있습니다. 자세한 내용은 컨트롤 옵션 및 일반적인 작업 속성을 참조하세요.

출력 변수

이 작업은 다운스트림 단계, 작업 및 단계에서 사용할 수 있는 다음 출력 변수를 정의합니다.

KubectlOutput
명령의 출력을 저장합니다 kubectl .

설명

버전 1.0의 새로운 기능

  • Azure AKS 클러스터를 쉽게 선택할 수 있는 새 서비스 연결 유형 입력이 추가되었습니다.
  • 출력 변수 입력을 모든 작업에 추가한 출력 변수 섹션으로 바꿉니다.

kubectl 명령을 실행하여 Kubernetes 클러스터를 배포, 구성 또는 업데이트하려면 이 작업을 사용합니다.

서비스 연결

이 작업은 아래에 설명된 두 가지 서비스 연결 유형인 Azure Resource ManagerKubernetes Service Connection에서 작동합니다.

Azure Resource Manager

를 로 Azure Resource Manager 설정하고 connectionType 를 지정 azureSubscriptionEndpoint 하여 Azure Resource Manager 서비스 연결을 사용합니다.

이 YAML 예제에서는 Azure Resource Manager Kubernetes 클러스터를 참조하는 데 사용되는 방법을 보여줍니다. 이는 kubectl 명령 중 하나와 명령에 필요한 적절한 값과 함께 사용됩니다.

variables:
  azureSubscriptionEndpoint: Contoso
  azureContainerRegistry: contoso.azurecr.io
  azureResourceGroup: Contoso
  kubernetesCluster: Contoso
  useClusterAdmin: false

steps:
- task: Kubernetes@1
  displayName: kubectl apply
  inputs:
    connectionType: Azure Resource Manager
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureResourceGroup: $(azureResourceGroup)
    kubernetesCluster: $(kubernetesCluster)
    useClusterAdmin: $(useClusterAdmin)

Kubernetes 서비스 연결

를 로 Kubernetes Service Connection 설정하고 connectionType Kubernetes 서비스 연결을 사용하도록 을 지정 kubernetesServiceEndpoint 합니다.

이 YAML 예제에서는 Kubernetes 서비스 연결을 사용하여 Kubernetes 클러스터를 참조하는 방법을 보여줍니다. 이는 kubectl 명령 중 하나와 명령에 필요한 적절한 값과 함께 사용됩니다.

- task: Kubernetes@1
  displayName: kubectl apply
  inputs:
    connectionType: Kubernetes Service Connection
    kubernetesServiceEndpoint: Contoso

AKS에 액세스할 때 Kubernetes Service 연결 고려 사항

다음 옵션 중 원하는 옵션을 사용하여 Kubernetes 서비스 연결을 만들 수 있습니다.

  • KubeConfig
  • 서비스 계정
  • Azure 구독

Kubernetes 서비스 연결 인증 방법을 선택하는 스크린샷

Azure 구독 옵션을 선택할 때 서비스 연결 구성 시 Azure DevOps에서 Kubernetes에 액세스할 수 있어야 합니다. 예를 들어 프라이빗 클러스터를 만들거나 클러스터로컬 계정을 사용하지 않도록 설정한 경우와 같이 서비스 연결을 만들 수 없는 여러 가지 이유가 있을 수 있습니다. 이러한 경우 Azure DevOps는 서비스 연결 구성 시 클러스터에 연결할 수 없으며 중단된 로딩 네임스페이스 화면이 표시됩니다.

네임스페이스를 로드할 때 중단된 Kubernetes 서비스 연결 인증 대화 상자를 선택하는 스크린샷

Kubernetes 1.24부터 수명이 긴 토큰은 기본적으로 더 이상 만들어지지 않습니다. Kubernetes는 수명이 긴 토큰을 사용하지 않는 것이 좋습니다. 따라서 Azure 구독 옵션을 사용하여 만든 Kubernetes 서비스 연결을 사용하는 작업은 인증에 필요한 영구 토큰에 액세스할 수 없으며 Kubernetes 클러스터에 액세스할 수 없습니다. 이로 인해 고정된 로딩 네임스페이스 대화 상자도 생성됩니다 .

Azure Resource Manager 서비스 연결을 사용하여 AKS에 액세스

AKS 고객의 경우 Azure Resource Manager 서비스 연결 유형은 프라이빗 클러스터 또는 로컬 계정이 비활성화된 클러스터에 연결하는 가장 좋은 방법을 제공합니다. 이 메서드는 서비스 연결을 만들 때 클러스터 연결에 종속되지 않습니다. AKS에 대한 액세스는 파이프라인 런타임으로 지연되며 다음과 같은 이점이 있습니다.

  • (프라이빗) AKS 클러스터에 대한 액세스는 클러스터에 대한 가시선이 있는 자체 호스팅 또는 확장 집합 에이전트에서 수행할 수 있습니다.
  • Azure Resource Manager 서비스 연결을 사용하는 모든 작업에 대해 토큰이 만들어집니다. 이렇게 하면 Kubernetes 권장 사항인 수명이 짧은 토큰을 사용하여 Kubernetes에 연결할 수 있습니다.
  • 로컬 계정을 사용하지 않도록 설정한 경우에도 AKS에 액세스할 수 있습니다.

서비스 연결 FAQ

다음 오류 메시지가 표시됩니다. 서비스 계정과 연결된 비밀을 찾을 수 없습니다. 설명

Azure 구독과 Kubernetes 서비스 연결을 사용하고 있습니다. 이 메서드를 업데이트하여 수명이 긴 토큰을 만듭니다. 이는 5월 중순에 출시될 예정입니다. 그러나 Kubernetes 지침에 따라 수명이 긴 토큰을 사용하지 않고 Azure 서비스 연결 형식 사용을 시작하는 것이 좋습니다.

AKS를 사용 중이며 아무것도 변경하지 않으려는 경우 Kubernetes 서비스 연결에서 작업을 계속 사용할 수 있나요?

이 메서드를 업데이트하여 수명이 긴 토큰을 만듭니다. 이는 5월 중순에 출시될 예정입니다. 그러나 이 방법은 Kubernetes 지침에 위배된다는 점에 유의하세요.

Kubernetes 작업 및 Kubernetes 서비스 연결을 사용하지만 AKS는 사용하지 않습니다. 걱정해야 하나요?

작업은 이전과 같이 계속 작동합니다.

Kubernetes 서비스 연결 형식이 제거되나요?

Kubernetes 작업은 실행 중인 위치에 관계없이 모든 Kubernetes 클러스터에서 작동합니다. Kubernetes 서비스 연결은 계속 존재합니다.

나는 AKS 고객이고 모든 것이 잘 실행되고, 내가 행동해야합니까?

아무것도 변경할 필요가 없습니다. Kubernetes 서비스 연결을 사용하고 만드는 동안 Azure 구독을 선택한 경우 수명이 긴 토큰 사용에 대한 Kubernetes 지침을 알고 있어야 합니다.

Kubernetes 환경을 만들고 있으며 서비스 연결을 사용할 수 있는 옵션이 없습니다.

환경을 만드는 동안 AKS에 액세스할 수 없는 경우 빈 환경을 사용하고 입력을 connectionType Azure Resource Manager 서비스 연결로 설정할 수 있습니다.

AZURE Active Directory RBAC로 구성된 AKS가 있고 파이프라인이 작동하지 않습니다. 이러한 업데이트가 resolve 있나요?

AAD RBAC를 사용할 때 Kubernetes에 액세스하는 것은 토큰 생성과 관련이 없습니다. 대화형 프롬프트를 방지하기 위해 향후 업데이트에서 kubelogin 을 지원합니다.

명령

명령 입력은 kubectl 명령을 허용합니다.

이 YAML 예제에서는 apply 명령을 보여 줍니다.

- task: Kubernetes@1
  displayName: kubectl apply using arguments
  inputs:
    connectionType: Azure Resource Manager
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureResourceGroup: $(azureResourceGroup)
    kubernetesCluster: $(kubernetesCluster)
    command: apply
    arguments: -f mhc-aks.yaml

이 YAML 예제에서는 apply 명령을 사용하여 구성 파일을 사용하는 방법을 보여 줍니다.

- task: Kubernetes@1
  displayName: kubectl apply using configFile
  inputs:
    connectionType: Azure Resource Manager
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureResourceGroup: $(azureResourceGroup)
    kubernetesCluster: $(kubernetesCluster)
    command: apply
    useConfigurationFile: true
    configuration: mhc-aks.yaml

이 YAML 예제에서는 크기 조정 명령을 사용하여 배포의 복제본 수를 0으로 줄이는 방법을 보여 줍니다.

- task: Kubernetes@1
      displayName: 'Scale down deployment $(k8sDeployment) to 0'
      inputs:
        connectionType: 'Kubernetes Service Connection'
        kubernetesServiceEndpoint: $(kubernetesServiceConnection)
        command: 'scale'
        arguments: 'deployment/$(k8sDeployment) --replicas=0'
        namespace: $(namespace)

비밀

비밀 형식의 Kubernetes 개체는 암호, OAuth 토큰 및 ssh 키와 같은 중요한 정보를 보유하기 위한 것입니다. 이 정보를 비밀로 두는 것은 Pod 정의 또는 Docker 이미지에 그대로 두는 것보다 더 안전하고 유연합니다. Azure Pipelines는 아래에 설명된 대로 서비스 계정에 를 ImagePullSecrets 추가하거나 일반 비밀을 설정하는 작업을 간소화합니다.

ImagePullSecret

이 YAML 예제에서는 ImagePullSecrets의 설정을 보여 줍니다.

    - task: Kubernetes@1
      displayName: kubectl apply for secretType dockerRegistry
      inputs:
        azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
        azureResourceGroup: $(azureResourceGroup)
        kubernetesCluster: $(kubernetesCluster)
        command: apply
        arguments: -f mhc-aks.yaml
        secretType: dockerRegistry
        containerRegistryType: Azure Container Registry
        azureSubscriptionEndpointForSecrets: $(azureSubscriptionEndpoint)
        azureContainerRegistry: $(azureContainerRegistry)
        secretName: mysecretkey2
        forceUpdate: true

제네릭 비밀

이 YAML 예제에서는 secretArguments 입력에 대해 지정된 리터럴 값에서 제네릭 비밀을 만듭니다.

    - task: Kubernetes@1
      displayName: secretType generic with literal values
      inputs:
        azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
        azureResourceGroup: $(azureResourceGroup)
        kubernetesCluster: $(kubernetesCluster)
        command: apply
        arguments: -f mhc-aks.yaml
        secretType: generic
        secretArguments: --from-literal=contoso=5678
        secretName: mysecretkey

파이프라인 변수는 다음과 같이 리터럴 값을 지정하기 위한 인수를 전달하는 데 사용할 수 있습니다.

    - task: Kubernetes@1
      displayName: secretType generic with pipeline variables
      inputs:
        azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
        azureResourceGroup: $(azureResourceGroup)
        kubernetesCluster: $(kubernetesCluster)
        command: apply
        arguments: -f mhc-aks.yaml
        secretType: generic
        secretArguments: --from-literal=contoso=$(contosovalue)
        secretName: mysecretkey

ConfigMap

ConfigMaps를 사용하면 이미지 콘텐츠에서 구성 아티팩트 분리를 통해 컨테이너화된 애플리케이션의 이식성을 유지할 수 있습니다.

이 YAML 예제에서는 ConfigMap 파일을 가리켜 ConfigMap을 만듭니다.

    - task: Kubernetes@1
      displayName: kubectl apply
      inputs:
        configMapName: myconfig
        useConfigMapFile: true
        configMapFile: src/configmap

이 YAML 예제에서는 configMapArguments 입력으로 직접 리터럴 값을 지정하고 forceUpdate 를 true로 설정하여 ConfigMap을 만듭니다.

    - task: Kubernetes@1
      displayName: configMap with literal values
      inputs:
        azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
        azureResourceGroup: $(azureResourceGroup)
        kubernetesCluster: $(kubernetesCluster)
        command: apply
        arguments: -f mhc-aks.yaml
        secretType: generic
        secretArguments: --from-literal=contoso=$(contosovalue)
        secretName: mysecretkey4
        configMapName: myconfig
        forceUpdateConfigMap: true
        configMapArguments: --from-literal=myname=contoso

다음과 같이 파이프라인 변수를 사용하여 ConfigMap을 만들 때 리터럴 값을 전달할 수 있습니다.

    - task: Kubernetes@1
      displayName: configMap with pipeline variables
      inputs:
        azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
        azureResourceGroup: $(azureResourceGroup)
        kubernetesCluster: $(kubernetesCluster)
        command: apply
        arguments: -f mhc-aks.yaml
        secretType: generic
        secretArguments: --from-literal=contoso=$(contosovalue)
        secretName: mysecretkey4
        configMapName: myconfig
        forceUpdateConfigMap: true
        configMapArguments: --from-literal=myname=$(contosovalue)

문제 해결

내 Kubernetes 클러스터가 방화벽 뒤에 있고 호스트된 에이전트를 사용하고 있습니다. 이 클러스터에 배포하려면 어떻게 해야 하나요?

호스트된 에이전트에 대한 IP 주소를 허용하여 호스트된 에이전트에서 방화벽을 통해 액세스하도록 허용할 수 있습니다. 자세한 내용은 에이전트 IP 범위를 참조하세요.

요구 사항

요구 사항 Description
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
실행 중 에이전트, DeploymentGroup
요청 없음
Capabilities 이 작업은 작업의 후속 작업에 대한 요구를 충족하지 않습니다.
명령 제한 사항 모두
Settable 변수 모두
에이전트 버전 지원되는 모든 에이전트 버전입니다.
작업 범주 배포