Kubernetes REST plugin

The Kubernetes REST plugin provides steps to create, update, and delete Kubernetes resources, copy files from or to a pod, and run a command in a pod.

Overview

The Kubernetes REST plugin interacts with a Kubernetes cloud environment through the REST client.

The plugin uses a configuration file, sometimes called the kubeconfig file, in which you define your Kubernetes cluster settings. For details on creating a configuration file, see the Kubernetes documentation.

The plugin offers similar functionality to that of the Kubernetes CLI plugin, but with a restricted scope. For details, see the Kubernetes CLI plugin.

The following table describes the Kubernetes REST plugin's steps.

Step Description
Copy Files Copies a file or directory to or from a pod. See Step: Copy Files.
Create Resources Creates one or more resources of the deployment, stateful set, service, namespace, daemon set, node, or persistent volume types based on a YAML or JSON file. See Step: Create Resources.
Delete Resources Removes a resource of the deployment, stateful set, service, namespace, daemon set, node, or persistent volume types. See Step: Delete Resources.
Run Command Runs a command in a single-container pod. See Step: Run Command.
Patch Resources Updates a resource of the deployment, stateful set, service, namespace, daemon set, node, or persistent volume types. See Step: Patch Resources.

Back to top

Before you begin

To use the Kubernetes REST plugin, complete the prerequisite tasks described in this section.

Before you can use the plugin:

  1. Verify that your Deployment Automation user role allows you to manage plugins. For details, see Server roles and system security.

  2. Configure the kubeconfig file. For details, see the Kubernetes documentation.

  3. Download the DA plugins bundle from the Deployment Automation support page. Extract the Kubernetes REST plugin zip file from the bundle and load it 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 REST in the Tools pane.

For details about creating processes, see Create and design component processes and Create and design global processes.

Back to top

Step: Copy Files

The Copy Files step copies a file or directory to or from a pod. By default, a file or directory is copied from a pod. To copy to a pod, select the Copy to Pod option.

The following table describes step-specific properties.

Property Description
Name Enter a name for the step. By default, the system uses the command name.
Kube Config File

Enter the path to the kubeconfig file. The following property is used by default:

${p:resource/KubernetesConfig}

For details on how to create resource properties, see Add or edit resource properties.

Namespace

Enter the namespace on the Kubernetes server where a command will run.

Leave the field empty to use the default namespace of your Kubernetes environment.

Pod Name

Copy from pod: Enter the name of the Kubernetes pod from which to copy files.

Copy to pod: Enter the name of the Kubernetes pod to which to copy files.

Container

If the pod runs multiple containers:

Copy from pod: Enter the name of the container from which to copy files.

Copy to pod: Enter the name of the container to which to copy files.

If you don't specify a container for a multi-container pod, the step will fail.

Copy to Pod

(Optional) Select this option to copy a file or directory to a pod. You can copy only one file or directory.

Keep this option cleared to copy a file or directory from a pod.

Source Path

Copy from pod: Enter the path to the file or directory to be copied.

Copy to pod: Enter the path to the file or directory to which you want to copy.

For a Kubernetes location, provide an absolute path.

Destination Path

Copy from pod: Enter the path to the file or directory to which you want to copy.

Copy to pod: Enter the path to the file or directory to be copied.

For a Kubernetes location, provide an absolute path.

For properties that are common to all plugin's steps, see Common properties.

Back to top

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.
Kube Config File

Enter the path to the kubeconfig file. The following property is used by default:

${p:resource/KubernetesConfig}

For details on how to create resource properties, see Add or edit resource properties.

Namespace

Enter the namespace on the Kubernetes server where a command will run.

Leave the field empty to use the default namespace of your Kubernetes environment.

File Name

Enter the URL or path to the file you want to use for creating resources, for example:

https://k8s.io/examples/controllers/nginx-deployment.yaml

You can create the following resource types:

  • Deployment

  • Stateful Set

  • Service

  • Namespace

  • Daemon Set

  • Node

  • Persistent Volume

The supported file formats are YAML and JSON.

For properties that are common to all plugin's steps, see Common properties.

Back to top

Step: Delete Resources

The Delete Resources step deletes a Kubernetes resource based on the resource type.

The following table describes step-specific properties.

Property Description
Name Enter a name for the step. By default, the system uses the command name.
Kube Config File

Enter the path to the kubeconfig file. The following property is used by default:

${p:resource/KubernetesConfig}

For details on how to create resource properties, see Add or edit resource properties.

Namespace

Enter the namespace on the Kubernetes server where a command will run.

Leave the field empty to use the default namespace of your Kubernetes environment.

Resource Type

Select the type of a resource to delete:

  • Deplyment

  • Stateful Set

  • Service

  • Namespace

  • Daemon Set

  • Node

  • Persistent Volume

Resource Enter the name of the resource to delete. You can delete only one resource.

For properties that are common to all plugin's steps, see Common properties.

Back to top

Step: Run Command

The Run Command step runs a command in a single-container 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.
Kube Config File

Enter the path to the kubeconfig file. The following property is used by default:

${p:resource/KubernetesConfig}

For details on how to create resource properties, see Add or edit resource properties.

Namespace

Enter the namespace on your Kubernetes server where the command will run.

Leave the field empty to use the default namespace of your Kubernetes environment.

Pod

Enter the name of the pod where a command will run. Use a pod that runs a single container. If there are multiple containers in a pod, the step will fail.

Command Enter a command to run in the pod.

For properties that are common to all plugin's steps, see Common properties.

Back to top

Step: Patch Resources

The Patch Resources step updates the fields of a resource in a Kubernetes cluster using a strategic merge or a JSON patch.

The following table describes step-specific properties.

Property Description
Name Enter a name for the step. By default, the system uses the command name.
Kube Config File

Enter the path to the kubeconfig file. The following property is used by default:

${p:resource/KubernetesConfig}

For details on how to create resource properties, see Add or edit resource properties.

Namespace

Enter the namespace on the Kubernetes server where a command will run.

Leave the field empty to use the default namespace of your Kubernetes environment.

Patch Format

Select the format for updating resources:

  • JSON patch

  • Strategic merge

Resource Type

Select the type of a resource to update:

  • Deployment

  • Stateful Set

  • Service

  • Namespace

  • Daemon Set

  • Node

  • Persistent Volume

Resource Enter the name of the resource to update. You can patch only one resource.
File Name

Enter the path to the file you want to use for patching resources.

Strategic merge supports YAML and JSON file formats, and JSON patch supports JSON format.

For properties that are common to all plugin's steps, see Common properties.

Back to top

Common properties

The following optional properties are common to all Kubernetes REST plugin steps.

Property Description
Ignore Failure If this option is selected, the step will always be considered to have run successfully.
Working Directory Enter an alternative absolute path to the working directory for the step. Leave the field empty to use the default working directory for the process.
Post Processing Script

Enter your custom post-processing script.

A post-processing script helps ensure that expected results occur. It runs after a step finishes processing. By default, Deployment Automation uses the step's default script. For details, see 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 to set up user impersonation for Deployment Automation agents. For details, see User impersonation.
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: Enter prop.* to select all properties with names that start with prop.

Secure properties are stored encrypted, and their values are displayed obscured in the Deployment Automation user interface.

Debug Logs Select this option to include debug information in logs.

Back to top

See also: