Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node enables interaction with a Kubernetes cluster by performing various operations on Kubernetes resources. It is particularly useful for automating Kubernetes management tasks such as running commands inside pods, retrieving resource information, deleting resources, and more.

For the exec operation specifically, the node executes a command inside a specified pod within a Kubernetes namespace and returns the output of that command. This can be beneficial for debugging, monitoring, or managing applications running inside Kubernetes pods without needing direct access to the cluster.

Practical example:
You want to run a diagnostic command like ls /app inside a specific pod to check the contents of the application directory. Using this node with the exec operation, you specify the pod (resource name), namespace, and the command array to execute, then receive the command output directly in your workflow.

Properties

Name Meaning
Image The container image name related to the operation (used mainly for run, restart, exec, patch).
Namespace The Kubernetes namespace where the target resource (e.g., pod) resides. Defaults to "default".
Resource Name The name of the specific Kubernetes resource (e.g., pod name) to operate on.

Note: Although the bundled properties JSON includes only these three, the full node supports additional properties like operation, command (for run), resource, fieldSelector, and labelSelector which influence behavior but are outside the scope of the provided input properties.

Output

The node outputs an array of JSON objects representing the result of the executed operation. For the exec operation, the output JSON contains the standard output (stdout) from the command executed inside the pod.

Example output structure for exec:

[
  {
    "stdout": "<command output string>"
  }
]

If multiple items are processed, the output will contain one object per item, each tagged with metadata linking it back to the input item.

The node does not output binary data for the exec operation.

Dependencies

  • Requires connection credentials to a Kubernetes cluster via an API authentication token or similar credential.
  • The node depends on a Kubernetes client utility internally to communicate with the Kubernetes API.
  • Proper permissions must be granted to the credentials used, allowing execution of commands inside pods (exec permission).
  • No additional external services beyond the Kubernetes API are required.

Troubleshooting

  • No credentials got returned!
    This error indicates missing or misconfigured Kubernetes credentials. Ensure that valid credentials are set up and linked to the node.

  • Command must be an array!
    The command property must be a JSON array of strings representing the command and its arguments. Providing a non-array value will cause this error. Fix by ensuring the command is formatted as an array, e.g., ["ls", "/app"].

  • Permission denied or forbidden errors from Kubernetes API
    These indicate insufficient permissions for the provided credentials. Verify that the service account or user has the necessary RBAC roles to perform exec operations on pods.

  • Resource not found or invalid namespace
    Confirm that the specified resource name and namespace exist in the cluster.

Links and References

Discussion