Skip to main content

Kubernetes Plugins


Kubernetes Plugins

Overview

Process Automation integrates with Kubernetes through a variety of plugins listed below. By integrating Process Automation with Kubernetes, users can automate and provide self-service interfaces for operations in their Kubernetes Clusters. These integrations allow operations teams to provide self-service mechanisms to users throughout the business, as well as setup event-driven automation for workflows with Kubernetes.

Plugin NamePlugin TypeDescription
Create Deploymentopen in new windowNode StepCreate a new deployment.
Delete Deploymentopen in new windowNode StepDelete an existing deployment.
Deployment Statusopen in new windowNode StepGet the status of an existing deployment.
Update Deploymentopen in new windowNode StepUpdate an existing deployment.
Waitfor Deploymentopen in new windowNode StepPause workflow until deployment is complete.
Create Jobopen in new windowNode StepCreate a new Kubernetes job.
Delete Jobopen in new windowNode StepDelete an existing Kubernetes job.
Re-run Jobopen in new windowNode StepRe-runs an existing Kubernetes job.
Waitfor Jobopen in new windowNode StepPause workflow until Kubernetes job is complete.
Create Serviceopen in new windowNode StepCreate a new Kubernetes service.
Update Serviceopen in new windowNode StepUpdate an existing Kubernetes service.
Delete Serviceopen in new windowNode StepDelete an existing Kubernetes service.
Pods Node SourceResource ModelPopulates node inventory with Kubernetes pods.
Create Podopen in new windowNode StepCreate a new Kubernetes pod.
Delete Podopen in new windowNode StepDelete an existing Kubernetes pod.
Describe Podopen in new windowNode StepDescribe a running Kubernetes pod.
Execute Commandopen in new windowNode StepExecute a command inside a container in a running pod.
Execute Scriptopen in new windowNode StepExecute a script inside a container in a running pod.
Pod Logsopen in new windowNode StepView the logs of a running pod.
Waitfor Podopen in new windowNode StepPause workflow until pod is in "ready" state.
Debug Podopen in new windowNode StepDebug a running container inside an existing pod using an ephemeral container.
Waitfor StatefulSetopen in new windowNode StepPause workflow until StatefulSet has been successfully deployed.

Click to expand to see the full list of Process Automation plugins for Kubernetes.

Setup

Python Dependencies

In order to use the Kubernetes python must be installed on the Process Automation cluster-members or on the Enterprise Runneropen in new window - depending on where the connection to Kubernetes is going to originate.

The Kubernetes plugins will work with both Python 2.7.x and Python 3.x.x.

Once python is installed, download and install the kubernetes python client. For Python 2.7.x this can be done with pip install kubernetes and for Python 3.x.x this can be done with pip3 install kubernetes.

Optionally test that the Kubernetes client has been installed successfully by executing the following at the command-line: python followed by from kubernetes import client, config:

ubuntu@ip-172-31-13-91:~$ python
Python 2.7.17 (default, Mar  8 2023, 18:40:28) 
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from kubernetes import client, config
>>>

Kubernetes Authentication

By default, the Kubernetes plugins look for a Kube Config file at $RDECK_BASE/.kube/config. For Deb and RPM this would translate to /var/lib/rundeck/.kube/config. The Kube Config file can be saved to a different location, just be sure to take note of where it is saved for later steps.

If it is preferred to use a Kubernetes API Token, then follow the instructions outlined hereopen in new window to generate the Service Account Token. Once created, save the Token to Key Storageopen in new window as a Password secret type.

Upload Kubernetes Plugins (Rundeck OSS Only)

Rundeck OSS does not come preloaded with the Kubernetes plugins. To install the Kubernetes plugins, use the following steps:

  1. Navigate to the latest plugin releaseopen in new window on Github and download the kubernetes-X.X.XX.zip file.

  2. In Rundeck, click the Gear Icon and then click the Plugins > Upload Plugin: Upload Plugins Menu
  3. Click Browse and select the downloaded .zip file from Step 2.
  4. Click Install: Upload Kubernetes Plugins

Test Kubernetes Plugins

To test that the dependencies and authentication have been configured correctly, use a Kubernetes Node Step plugin - as this will provide the option to easily execute the plugin in debug mode.

  1. Create a new Job.
  2. Navigate to the Workflow tab.
  3. Click + Add a step.
  4. In the Search step field type Kubernetes.
  5. Select the Kubernetes / Pod / Describe plugin from the list.
  6. Type in a pod name into the Name field. K8s Describe Pod
  7. Type in the namespace of the pod in the Namespace field.
  8. If the Kube Config file is saved in the directory $RDECK_BASE/.kube/config (/var/lib/rundeck/.kube/configfor RPM and Deb), then the authentication fields can be left blank.
    • Otherwise, specify the custom Kube Config location.
  9. Optionally chance the Python Interpreter if python scripts are not invoked using python my_script.py but rather python2 my_script.py or python3 my_script.py.
  10. Click Save on the Job Step and then Save to save the Job.
  11. Click Run Job Now to test that the configuration is correct.

Now that configuration is complete, take a look at use-cases for Process Automation with Kubernetes such as Capturing Debug Data from Apps in Kubernetesopen in new window or Managing Kubernetes with Rundeckopen in new window.