Kubernetes@0 - Kubectl v0 工作

執行命令,使用此工作在 Azure Container Service kubectl 中部署、設定或更新 Kubernetes 叢集。

Syntax

# Kubectl v0
# Deploy, configure, update a Kubernetes cluster in Azure Container Service by running kubectl commands.
- task: Kubernetes@0
  inputs:
    #kubernetesServiceConnection: # string. Alias: kubernetesServiceEndpoint. Kubernetes service connection. 
    #namespace: # string. Namespace. 
  # Commands
    #command: # 'apply' | 'create' | 'delete' | 'exec' | 'expose' | 'get' | 'logs' | 'run' | 'set' | 'top'. Command. 
    #useConfigurationFile: false # boolean. Use Configuration files. Default: false.
    #configuration: # string. Required when useConfigurationFile = true. Configuration file. 
    #arguments: # string. Arguments. 
  # Secrets
    secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required. Type of secret. Default: dockerRegistry.
    #secretArguments: # string. Optional. Use when secretType = generic. Arguments. 
    containerRegistryType: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required when secretType = dockerRegistry. Container Registry type. Default: Azure Container Registry.
    #dockerRegistryConnection: # string. Alias: dockerRegistryEndpoint. Optional. Use when secretType = dockerRegistry && containerRegistryType = Container Registry. Docker Registry service connection. 
    #azureSubscription: # string. Alias: azureSubscriptionEndpoint. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry. Azure Container Registry. 
    #secretName: # string. Secret name. 
    #forceUpdate: true # boolean. Force update secret. Default: true.
  # ConfigMaps
    #configMapName: # string. ConfigMap name. 
    #forceUpdateConfigMap: false # boolean. Force update configmap. Default: false.
    #useConfigMapFile: false # boolean. Use file. Default: false.
    #configMapFile: # string. Required when useConfigMapFile = true. ConfigMap file. 
    #configMapArguments: # string. Optional. Use when useConfigMapFile = false. Arguments. 
  # Advanced
    #versionOrLocation: 'version' # 'version' | 'location'. Kubectl. Default: version.
    #versionSpec: '1.7.0' # string. Optional. Use when versionOrLocation = version. Version spec. Default: 1.7.0.
    #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).
  # Output
    #outputFormat: 'json' # 'json' | 'yaml'. Output format. Default: json.
    #kubectlOutput: # string. Output variable name.
# Deploy to Kubernetes v0
# Deploy, configure, update a Kubernetes cluster in Azure Container Service by running kubectl commands.
- task: Kubernetes@0
  inputs:
    #kubernetesServiceConnection: # string. Alias: kubernetesServiceEndpoint. Kubernetes service connection. 
    #namespace: # string. Namespace. 
  # Commands
    #command: # 'apply' | 'create' | 'delete' | 'exec' | 'expose' | 'get' | 'logs' | 'run' | 'set' | 'top'. Command. 
    #useConfigurationFile: false # boolean. Use Configuration files. Default: false.
    #configuration: # string. Required when useConfigurationFile = true. Configuration file. 
    #arguments: # string. Arguments. 
  # Secrets
    secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required. Type of secret. Default: dockerRegistry.
    #secretArguments: # string. Optional. Use when secretType = generic. Arguments. 
    containerRegistryType: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required when secretType = dockerRegistry. Container Registry type. Default: Azure Container Registry.
    #dockerRegistryConnection: # string. Alias: dockerRegistryEndpoint. Optional. Use when secretType = dockerRegistry && containerRegistryType = Container Registry. Docker Registry service connection. 
    #azureSubscription: # string. Alias: azureSubscriptionEndpoint. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry. Azure Container Registry. 
    #secretName: # string. Secret name. 
    #forceUpdate: true # boolean. Force update secret. Default: true.
  # ConfigMaps
    #configMapName: # string. ConfigMap name. 
    #forceUpdateConfigMap: false # boolean. Force update configmap. Default: false.
    #useConfigMapFile: false # boolean. Use file. Default: false.
    #configMapFile: # string. Required when useConfigMapFile = true. ConfigMap file. 
    #configMapArguments: # string. Optional. Use when useConfigMapFile = false. Arguments. 
  # Advanced
    #versionOrLocation: 'version' # 'version' | 'location'. Kubectl. Default: version.
    #versionSpec: '1.7.0' # string. Optional. Use when versionOrLocation = version. Version spec. Default: 1.7.0.
    #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).
  # Output
    #outputFormat: 'json' # 'json' | 'yaml'. Output format. Default: json.
    #kubectlOutput: # string. Output variable name.
# Deploy to Kubernetes v0
# Deploy, configure, update your Kubernetes cluster in Azure Container Service by running kubectl commands.
- task: Kubernetes@0
  inputs:
    #kubernetesServiceConnection: # string. Alias: kubernetesServiceEndpoint. Kubernetes service connection. 
    #namespace: # string. Namespace. 
  # Commands
    command: 'apply' # 'apply' | 'create' | 'delete' | 'exec' | 'expose' | 'get' | 'logs' | 'run' | 'set' | 'top'. Required. Command. Default: apply.
    #useConfigurationFile: false # boolean. Use Configuration files. Default: false.
    #configuration: # string. Required when useConfigurationFile = true. Configuration file. 
    #arguments: # string. Arguments. 
  # Secrets
    secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required. Type of secret. Default: dockerRegistry.
    #secretArguments: # string. Optional. Use when secretType = generic. Arguments. 
    containerRegistryType: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required when secretType = dockerRegistry. Container Registry type. Default: Azure Container Registry.
    #dockerRegistryConnection: # string. Alias: dockerRegistryEndpoint. Optional. Use when secretType = dockerRegistry && containerRegistryType = Container Registry. Docker Registry service connection. 
    #azureSubscription: # string. Alias: azureSubscriptionEndpoint. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry. Azure Container Registry. 
    #secretName: # string. Secret name. 
    #forceUpdate: true # boolean. Force update secret. Default: true.
  # ConfigMaps
    #configMapName: # string. ConfigMap name. 
    #forceUpdateConfigMap: false # boolean. Force update configmap. Default: false.
    #useConfigMapFile: false # boolean. Use file. Default: false.
    #configMapFile: # string. Required when useConfigMapFile = true. ConfigMap file. 
    #configMapArguments: # string. Optional. Use when useConfigMapFile = false. Arguments. 
  # Advanced
    #versionOrLocation: 'version' # 'version' | 'location'. Kubectl. Default: version.
    #versionSpec: '1.7.0' # string. Optional. Use when versionOrLocation = version. Version spec. Default: 1.7.0.
    #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).
  # Output
    #outputFormat: 'json' # 'json' | 'yaml'. Output format. Default: json.
    #kubectlOutput: # string. Output variable name.

輸入

kubernetesServiceConnection - Kubernetes 服務連線
輸入別名: kubernetesServiceEndpointstring.

選取 Kubernetes 服務連線。


namespace - 命名空間
string.

使用 –namespace 旗標指定命令的kubectl命名空間。 如果未提供命名空間,命令將會在預設命名空間中執行。


command - 命令
string. 允許的值:applycreate、、runexecexposedeletelogsgetset、 。 top

指定要 kubectl 執行的命令。


command - 命令
string. 必要。 允許的值:applycreate、、runexecexposedeletelogsgetset、 。 top 預設值:apply

指定要 kubectl 執行的命令。


useConfigurationFile - 使用組態檔
boolean. 預設值:false

搭配 kubectl 命令使用 Kubernetes 組態檔。 您也可以提供 Kubernetes 組態檔的檔名、目錄或 URL。


configuration - 組態檔
string. 當 useConfigurationFile = true 時為必要。

指定與命令搭配使用的 kubernetes 組態檔檔名、目錄或 URL。


arguments - 參數
string.

指定指定 kubectl 命令的自變數。


secretType - 秘密類型
string. 必要。 允許值:dockerRegistrygeneric。 預設值:dockerRegistry

建立或更新泛型或 docker imagepullsecret。 指定 dockerRegistry 以建立或更新 imagepullsecret 所選取的 。 是 imagePullSecret 將包含容器登錄密碼的秘密傳遞至 Kubelet 的方法,因此可以代表 Pod 提取私人映像。


secretArguments - 參數
string. 選擇性。 使用 時 secretType = generic

指定要在秘密中插入的索引鍵和常值。 例如,--from-literal=key1=value1--from-literal=key2="top secret"


containerRegistryType - Container Registry 類型
string. 當 secretType = dockerRegistry 時為必要。 允許值:Azure Container RegistryContainer Registry。 預設值:Azure Container Registry

選取容器登錄類型。 工作可以使用 Azure 訂用帳戶詳細數據來處理 Azure Container Registry。 也支援其他標準容器登錄。


dockerRegistryConnection - Docker Registry 服務連線
輸入別名: dockerRegistryEndpointstring. 選擇性。 使用 時 secretType = dockerRegistry && containerRegistryType = Container Registry

選取 Docker 登錄服務連線。 需要向登錄進行驗證的命令所需。


azureSubscription - Azure 訂用帳戶
輸入別名: azureSubscriptionEndpointstring. 選擇性。 使用 時 secretType = dockerRegistry && containerRegistryType = Azure Container Registry

指定包含 Azure Container Registry的 Azure Resource Manager 訂用帳戶。

注意

若要設定新的服務連線,請從清單中選取 Azure 訂用帳戶,然後按兩下 Authorize。 如果您的訂用帳戶未列出,或您想要使用現有的服務主體,您可以使用 或 Manage 按鈕來設定 Azure 服務連線Add


azureContainerRegistry - Azure Container Registry
string. 選擇性。 使用 時 secretType = dockerRegistry && containerRegistryType = Azure Container Registry

指定用來提取容器映像並將應用程式部署至 Kubernetes 叢集的 Azure Container Registry。 需要向登錄進行驗證的命令所需。


secretName - 秘密名稱
string.

秘密的名稱。 您可以在 Kubernetes YAML 組態檔中使用此秘密名稱。


forceUpdate - 強制更新秘密
boolean. 預設值:true

如果密碼存在,請刪除密碼,並建立具有更新值的新密碼。


configMapName - ConfigMap 名稱
string.

ConfigMap 可讓您將組態成品與映像內容分離,讓容器化應用程式保持可攜。


forceUpdateConfigMap - 強制更新 configmap
boolean. 預設值:false

如果存在,請刪除 configmap,並建立具有更新值的新組態對應。


useConfigMapFile - 使用檔案
boolean. 預設值:false

藉由指定目錄,從個別檔案或從多個檔案建立 ConfigMap。


configMapFile - ConfigMap 檔案
string. 當 useConfigMapFile = true 時為必要。

指定包含 configMaps 的檔案或目錄。


configMapArguments - 參數
string. 選擇性。 使用 時 useConfigMapFile = false

指定要插入 的 configMap 索引鍵和常值。例如, --from-literal=key1=value1--from-literal=key2="top secret"


versionOrLocation - Kubectl
string. 允許的值: versionlocation (指定位置) 。 預設值:version

kubectl 是針對 Kubernetes 叢集執行命令的命令行介面。


versionSpec - 版本規格
string. 選擇性。 使用 時 versionOrLocation = version。 預設值:1.7.0

指定要取得的版本規格。 範例:1.7.0、、4.x.01.x.06.10.0>=6.10.0


checkLatest - 檢查最新版本
boolean. 選擇性。 使用時機 versionOrLocation = version。 預設值:false

請一律在線檢查符合版本規格的最新可用版本 (stable.txt) 。除非您有特定案例一律取得最新數據,否則這通常是 false。 這會導致在可能不需要時產生下載成本,特別是裝載的組建集區。


specifyLocation - Kubectl 的路徑
string. 當 versionOrLocation = location 時為必要。

指定檔案的完整路徑 kubectl.exe


workingDirectory - 工作目錄
輸入別名: cwdstring. 預設值:$(System.DefaultWorkingDirectory)

Kubectl 命令的工作目錄。


outputFormat - 輸出格式
string. 允許值:jsonyaml。 預設值:json

輸出格式。


kubectlOutput - 輸出變數名稱
string.

應該儲存命令輸出的變數名稱。


工作控制選項

除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控件選項和一般工作屬性

輸出變數

無。

規格需求

需求 描述
管線類型 YAML、傳統組建、傳統版本
執行於 Agent、DeploymentGroup
要求
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 任何
Settable 變數 任何
代理程式版本 所有支援的代理程式版本。
工作類別 部署