# Kubernetes Workflow Actions

Reference for the six Kubernetes Workflow Actions available through the PD Automation Runner — inputs, outputs, and supported object types.

This page documents each Kubernetes Workflow Action available through the [PD Automation Runner](/ai-automation/automation/pd-automation-runner): its inputs, supported object types, outputs, and example use cases. For an overview and how to register and connect a runner, see [PD Automation Runner](/ai-automation/automation/pd-automation-runner). For deployment, see [PD Automation Runner: Installation](/ai-automation/automation/pd-automation-runner/pd-runner-installation).

Each Kubernetes action requires a **Connection Input** that identifies which runner (and therefore which cluster) to target. If no runner appears in the list, verify the runner pod is running and shows **Healthy** in **Incident Workflows**  →  **Automation Connectors**  →  **Self-hosted Runners**.

## Actions at a Glance

| Action | What It Does | `kubectl` Equivalent |
| :--- | :--- | :--- |
| **List Objects** | Lists resources of a selected kind with optional namespace, label, and field filters | `kubectl get <type> [-n <namespace>] [-l <selector>]` |
| **Describe Object** | Returns full details for a named resource in JSON or YAML | `kubectl get <type> <name> -o json` or `yaml` |
| **Object Logs** | Retrieves log output from a pod, with optional tail and time-window filters | `kubectl logs <name> [-c <container>] [--tail=<n>]` |
| **Create Pod** | Creates a pod from a YAML definition | `kubectl create -f pod.yaml` |
| **Delete Pod** | Deletes a named pod | `kubectl delete pod <name>` |
| **Run Pod Command** | Executes a shell command inside a running pod and returns its output | `kubectl exec <pod> -- <shell> -c '<cmd>'` |

## List Objects

Lists resources of a selected kind in your cluster, with optional namespace, label, and field filters.

**kubectl equivalent:** `kubectl get <type> [-n <namespace> | --all-namespaces] [-l <label-selector>] [--field-selector <field-selector>] [-o json|yaml]`

| Input | Required | Default | Description |
| :--- | :--- | :--- | :--- |
| Connection Input | Yes | — | Runner connection |
| Object Type | No | Pods | Resource kind to list (see supported types in the following list) |
| Namespace | No | default | Namespace to list from. Ignored when All Namespaces is true |
| All Namespaces | No | false | List across all namespaces |
| Label Selector | No | — | Filter by label (e.g. `app=my-service,env=prod`) |
| Field Selector | No | — | Filter by field (e.g. `metadata.name=my-pod`) |
| Output Format | No | Simple List | `Simple List`, `JSON`, or `YAML` |

**Supported object types:** ConfigMaps, Cron Jobs, Custom Resource Definitions, DaemonSets, Deployments, Ingresses, Jobs, Namespaces, Nodes, PersistentVolumes, Persistent Volume Claims, Pods, Pod Disruption Budgets, ReplicaSets, Secrets, Services, StatefulSets, and Storage Classes.

**Output:** `Output` (list of matching resources), `Result`, `Result Summary`, and `Error`.

**Example use case:** During an incident, list all pods in the `payments` namespace to identify which are in a crash-loop state before deciding whether to restart them.

## Describe Object

Retrieves full details for a named Kubernetes resource in JSON or YAML format. Returns structured output equivalent to `kubectl get -o json|yaml` (not the human-readable `kubectl describe` format).

**kubectl equivalent:** `kubectl get <type> <name> [-n <namespace>] -o json|yaml`

| Input | Required | Default | Description |
| :--- | :--- | :--- | :--- |
| Connection Input | Yes | — | Runner connection |
| Object Type | No | Pods | Resource kind |
| Name | Yes | — | Name of the resource |
| Namespace | No | default | Namespace (not required for cluster-scoped resources: Namespaces, Nodes, PersistentVolumes, Storage Classes) |
| Output Format | No | JSON | `JSON` or `YAML` |

**Supported object types:** ConfigMaps, Cron Jobs, DaemonSets, Deployments, Ingresses, Jobs, Namespaces, Nodes, PersistentVolumes, Persistent Volume Claims, Pods, ReplicaSets, Secrets, Services, StatefulSets, and Storage Classes.

**Output:** `Description`, `Result`, `Result Summary`, and `Error`.

**Example use case:** Fetch the full spec and status of a deployment to check its `replicas`, `readyReplicas`, and `conditions` fields as part of an automated health check workflow.

## Object Logs

Retrieves log output from a named pod or container. Supports tailing and time-window filtering.

**kubectl equivalent:** `kubectl logs <name> [-c <container>] [--tail=<n>] [--since=<N>s] [-n <namespace>]`

| Input | Required | Default | Description |
| :--- | :--- | :--- | :--- |
| Connection Input | Yes | — | Runner connection |
| Namespace | Yes | — | Namespace the pod is in |
| Object Name | Yes | — | Name of the pod |
| Container | No | — | Container name (required for multi-container pods) |
| Lines | No | 50 | Number of log lines to tail |
| Since | No | — | Return logs from the last N seconds (e.g. `300` for the last 5 minutes) |

**Output:** `Log Content`, `Result`, `Result Summary`, and `Error`.

**Example use case:** Automatically capture the last 100 lines of logs from a failing pod and attach them to an incident as a note.

## Create Pod

Creates a Kubernetes pod from a YAML definition.

**kubectl equivalent:** `kubectl create -f pod.yaml [-n <namespace>]`

| Input | Required | Default | Description |
| :--- | :--- | :--- | :--- |
| Connection Input | Yes | — | Runner connection |
| Object YAML | Yes | — | Full YAML definition of the pod to create |
| Namespace | No | default | Namespace to create the pod in |
| Output Format | No | JSON | `JSON` or `YAML` |

**Output:** `Created Object`, `Result`, `Result Summary`, and `Error`.

**Example use case:** Spin up a short-lived debug pod in a target namespace to run diagnostics, then delete it with the Delete Pod action once complete.

## Delete Pod

Deletes a named pod from a namespace.

**kubectl equivalent:** `kubectl delete pod <name> [-n <namespace>]`

| Input | Required | Default | Description |
| :--- | :--- | :--- | :--- |
| Connection Input | Yes | — | Runner connection |
| Object Name | Yes | — | Name of the pod to delete |
| Namespace | No | default | Namespace the pod resides in |
| Output Format | No | JSON | `JSON` or `YAML` |

**Output:** `Deleted Object`, `Result`, `Result Summary`, and `Error`.

**Example use case:** Force-restart a stuck pod by deleting it (Kubernetes will reschedule it automatically if it is managed by a Deployment or ReplicaSet).

## Run Pod Command

Executes a shell command inside a running pod and returns its output.

**kubectl equivalent:** `kubectl exec <pod-name> [-c <container>] [-n <namespace>] -- <shell> -c '<command>'`

| Input | Required | Default | Description |
| :--- | :--- | :--- | :--- |
| Connection Input | Yes | — | Runner connection |
| Pod Name | Yes | — | Name of the pod |
| Namespace | No | default | Namespace the pod resides in |
| Command | Yes | — | Command to execute. Supports chaining with `&&`, `;`, and similar |
| Container | No | — | Target container (omit to use the pod's default container) |
| Shell | No | `/bin/sh` | Shell used to run the command |

**Output:** `Command Output`, `Result`, `Result Summary`, and `Error`.

**Example use case:** Run `df -h` or `free -m` inside a pod to capture disk and memory usage at the time of an incident without needing direct cluster access.

## Async Execution Model

All Kubernetes actions are asynchronous. When triggered, an action dispatches the job to the runner and waits for the runner to return a result. This means:

- The Workflow step is paused while the runner executes — results are returned when execution completes.
- The default timeout is 10 minutes. If the runner is unreachable, the action times out and returns a `Failed` result.
- Runner logs (`kubectl logs -n pd-automation-runner deploy/pd-automation-runner`) show the job receipt and execution result.

## Learn More

- [PD Automation Runner](/ai-automation/automation/pd-automation-runner)
- [PD Automation Runner: Installation](/ai-automation/automation/pd-automation-runner/pd-runner-installation)
- [Incident Workflows](/ai-automation/automation/incident-workflows)
