|
| 1 | +# Kubernetes Plugins for Rundeck Community |
| 2 | + |
| 3 | + |
| 4 | +Rundeck integrates with Kubernetes through a variety of plugins. By integrating Rundeck with Kubernetes, users can automate and provide self-service interfaces for operations in their Kubernetes Clusters. |
| 5 | + |
| 6 | +:::warning Commercial Kubernetes Plugins |
| 7 | +This document covers the plugins available in Rundeck Community (open source). If you are using one of the commercial Runbook Automation products, see documentation for the [**Commercial Kubernetes plugins**](/manual/plugins/kubernetes-plugins-overview.md). |
| 8 | +::: |
| 9 | + |
| 10 | +## Open Source Kubernetes Plugins |
| 11 | +<details><summary> <font size="5">List of Open Source Plugins</font> |
| 12 | +</summary> |
| 13 | + |
| 14 | +**Available in Rundeck Open Source** |
| 15 | + |
| 16 | +|Plugin Name| Plugin Type| Description| |
| 17 | +|:---------------------------------------------------------|:---------------------------------------------------------:|:---------------------------------------------------------| |
| 18 | +|[**Create Deployment**](/manual/jobs/job-plugins/node-steps/kubernetes-deployment-plugins.md#kubernetes-deployment-create)|Node Step|Create a new deployment.| |
| 19 | +|[**Delete Deployment**](/manual/jobs/job-plugins/node-steps/kubernetes-deployment-plugins.md#kubernetes-deployment-delete)|Node Step|Delete an existing deployment.| |
| 20 | +|[**Deployment Status**](/manual/jobs/job-plugins/node-steps/kubernetes-deployment-plugins.md#kubernetes-deployment-status)|Node Step|Get the status of an existing deployment.| |
| 21 | +|[**Update Deployment**](/manual/jobs/job-plugins/node-steps/kubernetes-deployment-plugins.md#kubernetes-deployment-update)|Node Step|Update an existing deployment.| |
| 22 | +|[**Waitfor Deployment**](/manual/jobs/job-plugins/node-steps/kubernetes-deployment-plugins.md#kubernetes-deployment-waitfor)|Node Step|Pause workflow until deployment is complete.| |
| 23 | +|[**Create Job**](/manual/jobs/job-plugins/node-steps/kubernetes-job-plugins.md#kubernetes-job-create)|Node Step|Create a new Kubernetes job.| |
| 24 | +|[**Delete Job**](/manual/jobs/job-plugins/node-steps/kubernetes-job-plugins.md#kubernetes-job-delete)|Node Step|Delete an existing Kubernetes job.| |
| 25 | +|[**Re-run Job**](/manual/jobs/job-plugins/node-steps/kubernetes-job-plugins.md#kubernetes-job-re-run)|Node Step|Re-runs an existing Kubernetes job.| |
| 26 | +|[**Waitfor Job**](/manual/jobs/job-plugins/node-steps/kubernetes-job-plugins.md#kubernetes-job-waitfor)|Node Step|Pause workflow until Kubernetes job is complete.| |
| 27 | +|[**Create Service**](/manual/jobs/job-plugins/node-steps/kubernetes-service-plugins.md#kubernetes-service-create)|Node Step|Create a new Kubernetes service.| |
| 28 | +|[**Update Service**](/manual/jobs/job-plugins/node-steps/kubernetes-service-plugins.md#kubernetes-service-update)|Node Step|Update an existing Kubernetes service.| |
| 29 | +|[**Delete Service**](/manual/jobs/job-plugins/node-steps/kubernetes-service-plugins.md#kubernetes-service-delete)|Node Step|Delete an existing Kubernetes service.| |
| 30 | +|[**Pods Node Source**](/manual/projects/resource-model-sources/kubernetes.md)|Resource Model|Populates node inventory with Kubernetes pods.| |
| 31 | +|[**Create Pod**](/manual/jobs/job-plugins/node-steps/kubernetes-pod-plugins.md#kubernetes-pod-create)|Node Step|Create a new Kubernetes pod.| |
| 32 | +|[**Delete Pod**](/manual/jobs/job-plugins/node-steps/kubernetes-pod-plugins.md#kubernetes-pod-delete)|Node Step|Delete an existing Kubernetes pod.| |
| 33 | +|[**Describe Pod**](/manual/jobs/job-plugins/node-steps/kubernetes-pod-plugins.md#kubernetes-pod-describe)|Node Step|Describe a running Kubernetes pod.| |
| 34 | +|[**Execute Command**](/manual/jobs/job-plugins/node-steps/kubernetes-pod-plugins.md#kubernetes-pod-execute-command)|Node Step|Execute a command inside a container in a running pod.| |
| 35 | +|[**Execute Script**](/manual/jobs/job-plugins/node-steps/kubernetes-pod-plugins.md#kubernetes-pod-execute-script)|Node Step|Execute a script inside a container in a running pod.| |
| 36 | +|[**Pod Logs**](/manual/jobs/job-plugins/node-steps/kubernetes-pod-plugins.md#kubernetes-pod-logs)|Node Step|View the logs of a running pod.| |
| 37 | +|[**Waitfor Pod**](/manual/jobs/job-plugins/node-steps/kubernetes-pod-plugins.md#kubernetes-pod-waitfor)|Node Step|Pause workflow until pod is in "ready" state.| |
| 38 | +|[**Debug Pod**](/manual/jobs/job-plugins/node-steps/kubernetes-debug-plugins.md#kubernetes-debug-ephemeral-container)|Node Step|Debug a running container inside an existing pod using an ephemeral container.| |
| 39 | +|[**Waitfor StatefulSet**](/manual/jobs/job-plugins/node-steps/kubernetes-statefulset-plugins.md#kubernetes-statefulset-waitfor)|Node Step|Pause workflow until StatefulSet has been successfully deployed.| |
| 40 | + |
| 41 | +**Plugins available only in Commercial products** |
| 42 | +> Note: All Open Source plugins also included. |
| 43 | +
|
| 44 | +|Plugin Name| Plugin Type| Description| |
| 45 | +|:---------------------------------------------------------|:---------------------------------------------------------:|:---------------------------------------------------------| |
| 46 | +|[**Amazon EKS Node Source**](/manual/projects/resource-model-sources/aws-eks.md)|Node Source|Imports Amazon Web Services EKS Clusters as Nodes.| |
| 47 | +|[**Azure AKS Node Source**](/manual/projects/resource-model-sources/azure-aks.md)|Node Source|Imports Azure AKS Clusters as Nodes.| |
| 48 | +|[**Google Cloud GKE Node Source**](/manual/projects/resource-model-sources/gcp-gke.md)|Node Source|Imports Google Cloud GKE Clusters as Nodes.| |
| 49 | +|[**Kubernetes Cluster Create Object**](/manual/jobs/job-plugins/node-steps/kubernetes-create-object)|Node Step|This plugin creates an object of a selected kind within a Kubernetes cluster.| |
| 50 | +|[**Kubernetes Cluster Delete Object**](/manual/jobs/job-plugins/node-steps/kubernetes-delete-object)|Node Step|This plugin deletes an object of a selected kind within a Kubernetes cluster.| |
| 51 | +|[**Kubernetes Cluster Describe Object**](/manual/jobs/job-plugins/node-steps/kubernetes-describe-object)|Node Step|This plugin describes an object of a selected kind within a Kubernetes cluster.| |
| 52 | +|[**Kubernetes Cluster List Objects**](/manual/jobs/job-plugins/node-steps/kubernetes-list-objects)|Node Step|This plugin lists objects of a selected kind within a Kubernetes cluster.| |
| 53 | +|[**Kubernetes Cluster Object Logs**](/manual/jobs/job-plugins/node-steps/kubernetes-object-logs)|This plugin allows you to view the logs of an object within a Kubernetes cluster.| |
| 54 | +|[**Kubernetes Cluster Run Command**](/manual/jobs/job-plugins/node-steps/kubernetes-run-command)|Node Step|This plugin allows you to execute a command in a pod within a Kubernetes cluster.| |
| 55 | +|[**Kubernetes Cluster Run Script**](/manual/jobs/job-plugins/node-steps/kubernetes-run-script)|Node Step|This plugin executes a script using a predefined container image within a Kubernetes cluster.| |
| 56 | +|[**Kubernetes Cluster Update Object**](/manual/jobs/job-plugins/node-steps/kubernetes-update-object)|Node Step|This plugin updates a specified object of a selected kind within a Kubernetes cluster.| |
| 57 | + |
| 58 | + |
| 59 | +</details> |
| 60 | +<br> |
| 61 | + |
| 62 | +:::tip |
| 63 | +Click above see the full list of plugins for Kubernetes. |
| 64 | +::: |
| 65 | + |
| 66 | +### Set up the Open Source Kubernetes Plugins |
| 67 | + |
| 68 | +#### Python Dependencies |
| 69 | + |
| 70 | +In order to use the Open Source Kubernetes plugins listed in the Summary above, Python must be installed on the Runbook Automation cluster-members or on the [Enterprise Runner](/administration/runner/index.md) - depending on where the connection to Kubernetes will originate. _(These steps are also needed for Commercial versions using the listed Open Source plugins.)_ |
| 71 | + |
| 72 | +The plugins will work with both **Python 2.7.x** and **Python 3.x.x**. |
| 73 | + |
| 74 | +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`**. |
| 75 | + |
| 76 | +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`**: |
| 77 | + |
| 78 | +``` |
| 79 | +ubuntu@ip-172-31-13-91:~$ python |
| 80 | +Python 2.7.17 (default, Mar 8 2023, 18:40:28) |
| 81 | +[GCC 7.5.0] on linux2 |
| 82 | +Type "help", "copyright", "credits" or "license" for more information. |
| 83 | +>>> from kubernetes import client, config |
| 84 | +>>> |
| 85 | +``` |
| 86 | + |
| 87 | +#### Kubernetes Authentication for Open Source Plugins |
| 88 | + |
| 89 | +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`**. |
| 90 | +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. |
| 91 | + |
| 92 | +If it is preferred to use a Kubernetes API Token, then follow the instructions outlined [here](https://www.cncf.io/blog/2020/07/31/kubernetes-rbac-101-authentication/) to generate the Service Account Token. |
| 93 | +Once created, save the Token to [Key Storage](/manual/system-configs.md#key-storage) as a **Password** secret type. |
| 94 | + |
| 95 | +#### Upload Kubernetes Plugins (Rundeck OSS Only) |
| 96 | + |
| 97 | +Rundeck OSS does not come preloaded with the Kubernetes plugins. To install the Kubernetes plugins, use the following steps: |
| 98 | + |
| 99 | +1. Navigate to the [latest plugin release](https://github.com/rundeck-plugins/kubernetes/releases/latest) on Github and download the **`kubernetes-X.X.XX.zip`** file.<br><br> |
| 100 | +2. In Rundeck, click the **Gear Icon** and then click the **Plugins > Upload Plugin**: |
| 101 | +  |
| 102 | +3. Click **Browse** and select the downloaded **`.zip`** file from Step 2. |
| 103 | +4. Click **Install**: |
| 104 | +  |
| 105 | + |
| 106 | +### Test Open Source Kubernetes Plugins |
| 107 | + |
| 108 | +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 |
| 109 | +execute the plugin in _debug_ mode. |
| 110 | + |
| 111 | +1. Create a new Job. |
| 112 | +2. Navigate to the **Workflow** tab. |
| 113 | +3. Click **+ Add a step**. |
| 114 | +4. In the **Search step** field type **`Kubernetes`**. |
| 115 | +5. Select the **Kubernetes / Pod / Describe** plugin from the list. |
| 116 | +6. Type in a pod name into the **Name** field. |
| 117 | +  |
| 118 | +7. Type in the namespace of the pod in the **Namespace** field. |
| 119 | +8. If the Kube Config file is saved in the directory **`$RDECK_BASE/.kube/config`** (`/var/lib/rundeck/.kube/config`for RPM and Deb), then the authentication fields can be left blank. |
| 120 | + * Otherwise, specify the custom Kube Config location. |
| 121 | +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`. |
| 122 | +10. Click **Save** on the Job Step and then **Save** to save the Job. |
| 123 | +11. Click **Run Job Now** to test that the configuration is correct. |
| 124 | + |
| 125 | +Now that configuration is complete, take a look at use-cases for Runbook Automation with Kubernetes such as |
| 126 | +[Capturing Debug Data from Apps in Kubernetes](/learning/solutions/automated-diagnostics/examples/k8s-app-debug-capture) |
| 127 | +or [Managing Kubernetes with Rundeck](/learning/howto/how2kube.md#managing-kubernetes-with-rundeck). |
0 commit comments