Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node allows interaction with Kubernetes clusters, specifically enabling operations on various Kubernetes resources such as Pods, Namespaces, Services, Deployments, and more. For the Pods resource with the Patch operation, the node is designed to modify existing Pod resources in a specified namespace by applying partial updates.

Common scenarios where this node is beneficial include:

  • Updating container images or configurations of running Pods without redeploying them entirely.
  • Applying quick fixes or configuration changes to Pods dynamically.
  • Automating maintenance tasks that require patching Pods based on certain conditions.

For example, you might use this node to patch a Pod to update its container image to a new version or to add labels/annotations for monitoring purposes.

Properties

Name Meaning
Image The container image name to be used when patching the Pod.
Namespace The Kubernetes namespace where the Pod resides. Defaults to "default".
Resource Name The name of the specific Pod resource to patch.

Note: Although the bundled code snippet does not explicitly show the patch logic implementation, these properties are relevant inputs for the Patch operation on Pods.

Output

The node outputs JSON data representing the result of the patch operation on the Pod resource. This typically includes the updated Pod object or status information returned from the Kubernetes API after applying the patch.

If the operation involves running commands or other interactions (not directly related to patch), the output may include command execution results such as standard output (stdout).

No binary data output is indicated for the Patch operation.

Dependencies

  • Requires an active connection to a Kubernetes cluster.
  • Needs valid Kubernetes API credentials (an API key or token) configured in n8n to authenticate requests.
  • Uses a Kubernetes client utility internally to communicate with the Kubernetes API.

Troubleshooting

  • No credentials got returned!
    This error indicates missing or misconfigured Kubernetes API credentials. Ensure that the node has access to valid credentials before execution.

  • Command must be an array!
    While not directly related to Patch, this error can occur if the Command property is incorrectly formatted for operations like Run. Make sure commands are provided as JSON arrays.

  • Resource not found or permission denied
    If the specified Pod or namespace does not exist or the credentials lack sufficient permissions, the Kubernetes API will return errors. Verify resource names, namespaces, and credential scopes.

  • Invalid patch format
    Since the patch logic is not fully detailed here, ensure that any patch payloads conform to Kubernetes API expectations (e.g., JSON Patch or Strategic Merge Patch formats).

Links and References

Discussion