Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node interacts with Kubernetes to perform operations on various Kubernetes resources. Specifically, for the 'CronJobs' resource with the 'Run' operation, it runs a pod using a specified container image and command within a given namespace, then retrieves the output of the pod's execution. This is useful for automating Kubernetes job executions and capturing their results within an n8n workflow.

Use Case Examples

  1. Run a Kubernetes CronJob pod with a specific container image and command, then use the output for further processing in the workflow.
  2. Automate running Kubernetes jobs on demand and handle their output programmatically.

Properties

Name Meaning
Image The container image to use for running the pod.
Command The command to execute inside the pod, provided as a JSON array.
Namespace The Kubernetes namespace where the pod will be run.
Resource Name The name of the Kubernetes resource (e.g., CronJob) to target.

Output

JSON

  • stdout - The standard output from running the pod with the specified image and command.

Dependencies

  • Requires Kubernetes API credentials to authenticate and interact with the Kubernetes cluster.

Troubleshooting

  • If no credentials are provided or returned, the node throws an error 'No credentials got returned!'. Ensure Kubernetes API credentials are correctly configured.
  • If the 'Command' input is not a valid JSON array, the node throws 'Command must be an array!'. Verify the command input format is correct JSON array.

Discussion