Muokkaa

Jaa


Kubernetes@0 - Kubectl v0 task

Use this task to deploy, configure, or update a Kubernetes cluster in Azure Container Service by running kubectl commands.

This version of the task is deprecated; use Kubernetes@1 to take advantage of the latest features like Workload identity federation.

Use this task to deploy, configure, or update a Kubernetes cluster in Azure Container Service by running kubectl commands.

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.

Inputs

kubernetesServiceConnection - Kubernetes service connection
Input alias: kubernetesServiceEndpoint. string.

Select a Kubernetes service connection.


namespace - Namespace
string.

Specifies the namespace for the kubectl command by using the –namespace flag. If the namespace is not provided, the commands will run in the default namespace.


command - Command
string. Allowed values: apply, create, delete, exec, expose, get, logs, run, set, top.

Specifies a kubectl command to run.


command - Command
string. Required. Allowed values: apply, create, delete, exec, expose, get, logs, run, set, top. Default value: apply.

Specifies a kubectl command to run.


useConfigurationFile - Use Configuration files
boolean. Default value: false.

Use Kubernetes configuration file with the kubectl command. Filename, directory, or URL to Kubernetes configuration files can also be provided.


configuration - Configuration file
string. Required when useConfigurationFile = true.

Specifies the filename, directory, or URL to kubernetes configuration files that is used with the commands.


arguments - Arguments
string.

Specifies the arguments to the specified kubectl command.


secretType - Type of secret
string. Required. Allowed values: dockerRegistry, generic. Default value: dockerRegistry.

Creates or updates a generic or docker imagepullsecret. Specify dockerRegistry to create or update the imagepullsecret of the selected registry. An imagePullSecret is a way to pass a secret that contains a container registry password to the Kubelet, so it can pull a private image on behalf of your Pod.


secretArguments - Arguments
string. Optional. Use when secretType = generic.

Specifies keys and literal values to insert in secret. For example, --from-literal=key1=value1 or --from-literal=key2="top secret".


containerRegistryType - Container Registry type
string. Required when secretType = dockerRegistry. Allowed values: Azure Container Registry, Container Registry. Default value: Azure Container Registry.

Select a Container registry type. The task can use Azure Subscription details to work with an Azure Container registry. Other standard Container registries are also supported.


dockerRegistryConnection - Docker Registry service connection
Input alias: dockerRegistryEndpoint. string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Container Registry.

Select a Docker registry service connection. Required for commands that need to authenticate with a registry.


azureSubscription - Azure subscription
Input alias: azureSubscriptionEndpoint. string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry.

Specifies the Azure Resource Manager subscription, which contains Azure Container Registry.

Note

To configure a new service connection, select the Azure subscription from the list and click Authorize. If your subscription is not listed or if you want to use an existing Service Principal, you can setup an Azure service connection using the Add or Manage buttons.


azureContainerRegistry - Azure Container Registry
string. Optional. Use when secretType = dockerRegistry && containerRegistryType = Azure Container Registry.

Specifies an Azure Container Registry which is used for pulling container images and deploying applications to the Kubernetes cluster. Required for commands that need to authenticate with a registry.


secretName - Secret name
string.

Name of the secret. You can use this secret name in the Kubernetes YAML configuration file.


forceUpdate - Force update secret
boolean. Default value: true.

Delete the secret if it exists and create a new one with updated values.


configMapName - ConfigMap name
string.

ConfigMaps allow you to decouple configuration artifacts from image content to keep containerized applications portable.


forceUpdateConfigMap - Force update configmap
boolean. Default value: false.

Delete the configmap if it exists and create a new one with updated values.


useConfigMapFile - Use file
boolean. Default value: false.

Create a ConfigMap from an individual file, or from multiple files by specifying a directory.


configMapFile - ConfigMap file
string. Required when useConfigMapFile = true.

Specify a file or directory that contains the configMaps.


configMapArguments - Arguments
string. Optional. Use when useConfigMapFile = false.

Specifies keys and literal values to insert in configMap .For example, --from-literal=key1=value1 or --from-literal=key2="top secret".


versionOrLocation - Kubectl
string. Allowed values: version, location (Specify location). Default value: version.

kubectl is a command line interface for running commands against Kubernetes clusters.


versionSpec - Version spec
string. Optional. Use when versionOrLocation = version. Default value: 1.7.0.

Specifies the Version Spec of the version to get. Examples: 1.7.0, 1.x.0, 4.x.0, 6.10.0, >=6.10.0.


checkLatest - Check for latest version
boolean. Optional. Use when versionOrLocation = version. Default value: false.

Always checks online for the latest available version (stable.txt) that satisfies the version spec. This is typically false unless you have a specific scenario to always get latest. This will cause it to incur download costs when potentially not necessary, especially with the hosted build pool.


specifyLocation - Path to Kubectl
string. Required when versionOrLocation = location.

Specifies the full path to the kubectl.exe file.


workingDirectory - Working directory
Input alias: cwd. string. Default value: $(System.DefaultWorkingDirectory).

Working directory for the Kubectl command.


outputFormat - Output format
string. Allowed values: json, yaml. Default value: json.

Output format.


kubectlOutput - Output variable name
string.

Name of the variable in which output of the command should be saved.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version All supported agent versions.
Task category Deploy