다음을 통해 공유


Kubernetes@1 - Kubectl v1 작업

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

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

통사론

# 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 인스턴스를 가져올 수 있습니다. Azure 구독 옵션을 사용하여 AKS 인스턴스를 가져오려면 서비스 연결 구성 시 Kubernetes 클러스터 액세스가 필요합니다.
  • Azure Resource Manager - AKS 인스턴스를 선택할 수 있습니다. 서비스 연결 구성 시 Kubernetes 클러스터에 액세스하지 않습니다.
  • None - 로컬에 저장된 미리 생성된 Kubernetes 구성을 사용합니다.

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


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

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


Kubernetes 서비스 연결kubernetesServiceEndpoint -
string. connectionType = Kubernetes Service Connection && command != logout때 필요합니다.

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


Azure 구독azureSubscriptionEndpoint -
string. connectionType = Azure Resource Manager && command != logout때 필요합니다.

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

메모

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


azureResourceGroup - 리소스 그룹
string. connectionType = Azure Resource Manager && command != logout때 필요합니다.

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


Kubernetes 클러스터kubernetesCluster -
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, exec, expose, get, login, logout, logs, run, set, top.

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


command - 명령
string. 필수. 허용되는 값: apply, create, delete, exec, expose, get, login, logout, logs, run, set, top. 기본값: apply.

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


useConfigurationFile - 구성 사용
boolean. 선택적. command != login && command != logout때 사용합니다. 기본값: false.

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


useConfigurationFile - 구성 파일 사용
boolean. 선택적. command != login && command != logout때 사용합니다. 기본값: false.

kubectl 명령에 사용할 Kubernetes 구성을 지정합니다. 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=key1=value1또는 --from-literal=key2="top secret".


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

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


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

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


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

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

메모

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


Azure Container RegistryazureContainerRegistry -
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.

비밀이 있으면 삭제하고 업데이트된 값을 사용하여 새 암호를 만듭니다.


configMap 이름configMapName -
string. 선택적. command != login && command != logout때 사용합니다.

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


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

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


useConfigMapFile - 파일 사용
boolean. 선택적. command != login && command != logout때 사용합니다. 기본값: false.

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


configMap 파일configMapFile -
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".


kubectlversionOrLocation -
string. 허용되는 값: version, location(위치 지정). 기본값: version.

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


kubectlversionOrLocation -
string. 선택적. command != login && command != logout때 사용합니다. 허용되는 값: version, location(위치 지정). 기본값: version.

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


versionSpec - 버전 사양
string. 선택적. versionOrLocation = version때 사용합니다. 기본값: 1.13.2.

가져올 버전의 버전 사양을 지정합니다. 예: 1.7.0, 1.x.0, 4.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.0, 4.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입니다. 이로 인해 잠재적으로 필요하지 않은 경우, 특히 호스트된 빌드 풀에서 다운로드 비용이 발생합니다.


kubectl대한 specifyLocation - 경로
string. versionOrLocation = location때 필요합니다.

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


kubectl대한 specifyLocation - 경로
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.

출력 형식입니다. 허용되는 값 목록은 작업 도우미를 사용할 때 선택 편의성을 위해 몇 가지 일반적인 선택 항목을 제공하지만 jsonpath={.items[*].spec['initContainers', 'containers'][*].image}같은 다른 출력 옵션을 지정할 수 있습니다.


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

출력 형식입니다. 허용되는 값 목록은 작업 도우미를 사용할 때 선택 편의성을 위해 몇 가지 일반적인 선택 항목을 제공하지만 jsonpath={.items[*].spec['initContainers', 'containers'][*].image}같은 다른 출력 옵션을 지정할 수 있습니다.


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

출력 형식입니다. 허용되는 값 목록은 작업 도우미를 사용할 때 선택 편의성을 위해 몇 가지 일반적인 선택 항목을 제공하지만 jsonpath={.items[*].spec['initContainers', 'containers'][*].image}같은 다른 출력 옵션을 지정할 수 있습니다.


작업 제어 옵션

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

출력 변수

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

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

발언

버전 1.0의 새로운 기능

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

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

서비스 연결

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

Azure Resource Manager

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

이 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 서비스 연결

connectionType 설정하여 Kubernetes Service Connection 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를 구성했는데 파이프라인이 작동하지 않습니다. 이러한 업데이트가 해결될까요?

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

명령을

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

이 YAML 예제에서는 명령을 적용하는 방법을 보여 줍니다.

- 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 범위 참조하세요.

요구 사항

요구 묘사
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
다음에서 실행 에이전트, DeploymentGroup
요구 없음
기능 이 작업은 작업의 후속 작업에 대한 요구 사항을 충족하지 않습니다.
명령 제한 어떤
settable 변수 어떤
에이전트 버전 지원되는 모든 에이전트 버전입니다.
작업 범주 전개시키다