Kubernetes CLI plugin
The Kubernetes CLI plugin enables you to manage resources in a Kubernetes cloud environment through the Kubernetes command-line tool, kubectl.
For a Deployment Automation integration with Kubernetes that doesn't require kubectl, see the Kubernetes REST plugin.
Overview
The Kubernetes CLI plugin provides a set of steps for managing Kubernetes resources. The plugin integrates with a Kubernetes cloud environment through the kubectl command-line tool.
The following table describes the plugin's steps.
Step | Description |
---|---|
Apply Configuration | Applies a configuration to one or more Kubernetes resources from a JSON or YAML file. See Step: Apply Configuration. |
Create Resources | Creates one or more Kubernetes resources from a JSON or YAML file. See Step: Create Resources. |
Delete Resources | Deletes Kubernetes resources by file name, resource type and name, or resource type and label. See Step: Delete Resources. |
Expose Resources | Exposes a resource, such as deployment, replication controller, service, or pod, as a new Kubernetes service. See Step: Expose Resources. |
Roll Out Deployment | Manages the rollout of a deployment using rollout subcommands. See Step: Roll Out Deployment. |
Run Command | Runs a command in a pod's container. See Step: Run Command. |
Run Image on Pod | Creates and runs a specified image in a pod. See Step: Run Image on Pod. |
Scale Resource | Changes the size of a resource, such as deployment, replica set, stateful set, or replication controller. See Step: Scale Resource. |
Set Container Image | Updates one or more container images of resources. See Step: Set Container Image. |
Update Label | Updates labels of one or more resources. See Step: Update Label. |
Before you begin
To use the Kubernetes CLI plugin, complete the prerequisite tasks described in this section.
Before you can use the plugin:
-
Verify that your have sufficient permissions for your Deployment Automation agent, and your user role allows you to manage plugins. For details, see Server roles and system security.
-
Install and set up the Kubernetes command-line tool kubectl on the Deployment Automation agent.
- Download the Deployment Automation plugin bundle, extract the Kubernetes CLI plugin zip file from the bundle, and load the file into Deployment Automation. For details, see Load and upgrade plugins.
To use the plugin steps, open your component or global process and navigate to Cloud > Kubernetes in the Tools pane.
For details about creating processes, see Create and design component processes and Create and design global processes.
Step: Apply Configuration
The Apply Configuration step applies a configuration to one or more Kubernetes resources from a file.
The following table describes step-specific properties.
Property | Description |
---|---|
Name | Enter a name for the step. By default, the system uses the command name. |
File Name |
Enter the URL or path to the file or directory you want to use for configuring resources. The supported file formats are JSON and YAML. |
Flags |
(Optional) Specify the flags to set when running the process. Enter each flag on a new line, for example: --recursive=true |
For properties that are common to all plugin's steps, see Common properties.
Step: Create Resources
The Create Resources step creates one or more Kubernetes resources from a YAML or JSON file.
The following table describes step-specific properties.
Property | Description |
---|---|
Name | Enter a name for the step. By default, the system uses the command name. |
File Name |
Enter the URL or path to the file or directory you want to use for creating resources. The supported file formats are JSON and YAML. |
Save Config | (Optional) Select this option to save the resource's current configuration if you need to update it in the future. |
Record Command | (Optional) Select this option to record current kubectl command in the resource annotation. |
Flags |
(Optional) Specify the flags to set when running the process. Enter each flag on a new line, for example: --recursive=true |
For properties that are common to all plugin's steps, see Common properties.
Step: Delete Resources
The Delete Resources step deletes Kubernetes resources based on filters such as file name, resource type and name, or resource type and label.
The following table describes step-specific properties.
Property | Description |
---|---|
Name | Enter a name for the step. By default, the system uses the command name. |
Deletion Type |
Select a filter for deleting resources: • Resource Types and Names. Delete resources based on their type and name. • Resource Types and Labels. Delete resources based on their type and label. • File. Delete resources specified in a file. • All Resources of Type. Delete all resources of a specified type. |
Resources |
Specify resources to delete. Use the format depending on the selected Deletion Type:
|
Flags |
(Optional) Specify the flags to set when running the process. Enter each flag on a new line, for example: --recursive=true |
For properties that are common to all plugin's steps, see Common properties.
Step: Expose Resources
The Expose Resources step exposes a resource as a new Kubernetes service.
The following table describes step-specific properties.
Property | Description |
---|---|
Name | Enter a name for the step. By default, the system uses the command name. |
Resource Type |
Select the type of resources to expose: • Deployment. Expose deployments. • Replication Controller. Expose replication controllers. • Service. Expose services. • Pod. Expose pods. • File. Expose resources specified in a file. |
Resource |
Specify the resources to expose. Enter resource names separated by a comma. For the File resource type, enter the URL or path to the file or directory identifying resources. The supported file formats are JSON and YAML. |
Flags |
(Optional) Specify the flags to set when running the process. Enter each flag on a new line, for example: --recursive=true |
For properties that are common to all plugin's steps, see Common properties.
Step: Roll Out Deployment
The Roll Out Deployment step manages the rollout of a Kubernetes resource using rollout subcommands.
The following table describes step-specific properties.
Property | Description |
---|---|
Name | Enter a name for the step. By default, the system uses the command name. |
Command |
Select the rollout command:
|
Resource Type |
Select the type of resources to roll out: • Deployment • Daemon Set • Stateful Set |
Resource | Specify the resources to roll out. Enter resource names separated by a comma. |
Flags |
(Optional) Specify the flags to set when running the process. Enter each flag on a new line, for example: --recursive=true |
For properties that are common to all plugin's steps, see Common properties.
Step: Run Command
The Run Command step runs a command in a container.
The following table describes step-specific properties.
Property | Description |
---|---|
Name | Enter a name for the step. By default, the system uses the command name. |
Pod Name | Enter the name of the pod where the container is located, for example, 123456-7890. |
Container Name |
(Optional) Enter the name of the container in which to run the command. Leave the field empty to use the pod's first container. |
Command |
Enter a command to run in the container. |
For properties that are common to all plugin's steps, see Common properties.
Step: Run Image on Pod
The Run Image on Pod step creates and runs a specified image in a pod.
The following table describes step-specific properties.
Property | Description |
---|---|
Name | Enter a name for the step. By default, the system uses the command name. |
Pod Name | Create a name for the running pod. |
Image Name | Enter the name of an image, for example, an image from the Docker registry. |
Flags |
(Optional) Specify the flags to set when running the process. Enter each flag on a new line, for example: --recursive=true |
Environment Variables |
Enter environment variables to pass to the image. To specify multiple variables, separate entries with a comma, for example:
|
For properties that are common to all plugin's steps, see Common properties.
Step: Scale Resource
The Scale Resource step changes the size of one or more Kubernetes resources.
The following table describes step-specific properties.
Property | Description |
---|---|
Name | Enter a name for the step. By default, the system uses the command name. |
Resource Type |
Select the type of resources to scale:
|
Resource |
Specify the resources to scale. Enter resource names separated by a comma. For the File resource type, enter the URL or path to the file or directory identifying resources for scaling. The supported file formats are JSON and YAML. |
Flags |
Specify the flags you want to set when running the scale process. Enter each flag on a new line, for example:
|
For properties that are common to all plugin's steps, see Common properties.
Step: Set Container Image
The Set Container Image step changes one or more container images of resources.
The following table describes step-specific properties.
Property | Description |
---|---|
Name | Enter a name for the step. By default, the system uses the command name. |
Resource Type |
Select the type of resources for which to update container images:
|
Resource |
Specify the resources for which to change container images. Enter resource names separated by a comma. For the File resource type, enter the URL or path to the file or directory identifying resources. The supported file formats are JSON and YAML. |
Image Versions |
Specify the image you want to change and the image to replace it with. Use this syntax:
If you enter an image without a version, the latest image version is used. To specify multiple images, separate entries with a space. |
Flags |
(Optional) Specify the flags to set when running the process. Enter each flag on a new line, for example: --recursive=true |
For properties that are common to all plugin's steps, see Common properties.
Step: Update Label
The Update Label step updates label values on one or more Kubernetes resources.
The following table describes step-specific properties.
Property | Description |
---|---|
Name | Enter a name for the step. By default, the system uses the command name. |
Resource Type |
Select a filter for updating labels on a resource:
|
Resource |
(Optional) Specify the resources for which to update labels. Enter resource names separated by a comma. For the File resource type, enter the URL or path to the file or directory identifying resources for which to update labels. The supported file formats are JSON and YAML. |
Labels |
Enter resource labels and their new values. Ensure that labels and values begin with a letter or number, contain only letters, numbers, hyphens, periods, and underscores, and don't exceed 63 characters each. Separate each name=value pair with a space, for example:
|
Overwrite |
(Optional) Select this option to overwrite the values of current labels. If this option is not selected, the label changes are rejected, and the step fails. |
Flags |
(Optional) Specify the flags to set when running the process. Enter each flag on a new line, for example: --recursive=true |
For properties that are common to all plugin's steps, see Common properties.
Common properties
The following optional properties are common to all Kubernetes CLI plugin steps.
Property | Description |
---|---|
URL | Enter the path to your Kubernetes server, for example, https://10.2.2.2:8443. |
Username | Enter your login for accessing the Kubernetes server. |
Password | Enter your password for accessing the Kubernetes server. |
Namespace |
Enter the namespace on the Kubernetes server in which to run command. Leave the field empty to use the default namespace of your Kubernetes environment. |
Ignore Failure | Select this option if you want the step to always be considered successful. |
Working Directory | Enter an alternative absolute path to the working directory for the step. To use the default working directory for the process, leave the field empty. |
Post Processing Script |
Select a custom post-processing script. To run the step's default script, leave the field empty. To create your custom post-processing script, click Add , and enter script details in the Create Script dialog box. A post-processing script helps ensure that expected results occur. It runs after a step finishes processing. For details, see Manage post-processing scripts. |
Precondition | Enter a JavaScript script to define a condition that must exist before the step can run. The condition resolves to true or false. |
Use Impersonation | Select this option if you want an agent to run the step as a different user. Specify the impersonation details for a Windows or UNIX/Linux agent, as described in Use impersonation to run processes. |
Hint | Add a comment to the step. To view the comment, point to the step in the design space. |
Hidden properties | |
Output properties secure rules |
Specify properties you want to be treated as secure. Enter each property name on a new line. Use regular expressions to select multiple properties. Example: To select all properties with names that start with prop, enter this regular expression: prop.* Secure properties are stored encrypted, and their values are displayed obscured in the Deployment Automation user interface. |
kubectl Path | Enter the name of the kubectl command if it's in the system path, or provide a full path to run the kubectl command. |
Global Flags |
Specify the global flags to set when running the kubectl command. Enter each global flag on a new line, for example: --insecure-skip-tls-verify --match-server-version --log-dir=’/var/logs/’ |
Debug Logs | Select this option to include debug information in logs. |
See also: