共用方式為


Kubernetes@0 - Kubectl v0 工作

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

此版本的工作已被取代;使用 Kubernetes@1 利用 工作負載身分識別同盟等最新功能。

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

語法

# 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.

輸入

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

選取 Kubernetes 服務連線。


namespace - 命名空間
string

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


command - 命令
string。 允許的值:applycreatedeleteexecexposegetlogsrunsettop

指定要執行的 kubectl 命令。


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

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


configuration - 組態檔
stringuseConfigurationFile = true時為必要項。

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


arguments - 自變數
string

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


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

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


secretArguments - 自變數
string。 選擇性。 secretType = generic時使用 。

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


containerRegistryType - Container Registry 類型
stringsecretType = dockerRegistry時為必要項。 允許的值:Azure Container RegistryContainer Registry。 預設值:Azure Container Registry

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


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

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


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

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

備註

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


azureContainerRegistry - Azure 容器註冊表
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 檔案
stringuseConfigMapFile = true時為必要項。

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


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.01.x.04.x.06.10.0>=6.10.0


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

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


specifyLocation - Kubectl 的路徑
stringversionOrLocation = location時為必要項。

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


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

Kubectl 命令的工作目錄。


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

輸出格式。


kubectlOutput - 輸出變數名稱
string

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


工作控制選項

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

輸出變數

沒有。

需求

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