Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node allows interaction with Kubernetes resources through various operations, including patching deployments. Specifically, the "Patch" operation on the "Deployments" resource enables users to modify existing deployment configurations dynamically within a specified namespace.

Common scenarios for this node include:

  • Updating container images or environment variables in a deployment without redeploying manually.
  • Applying configuration changes or rolling updates programmatically.
  • Automating deployment management as part of CI/CD pipelines.

For example, you might use this node to patch a deployment by changing its container image to a new version, triggering Kubernetes to roll out the update automatically.

Properties

Name Meaning
Image The container image name to use when patching or running pods.
Namespace The Kubernetes namespace where the deployment resides; defaults to "default".
Resource Name The name of the specific deployment resource to patch.

Note: These properties are shown when the operation is "patch" and the resource is "deployments".

Output

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

If the operation involves running pods or executing commands, the output may also include standard output (stdout) from those pod executions.

No binary data output is indicated in the source code.

Dependencies

  • Requires an API authentication token or credentials to access the Kubernetes cluster.
  • Depends on a Kubernetes client utility internally (referred to as K8SClient), which handles communication with the Kubernetes API.
  • The node expects valid Kubernetes credentials configured in n8n to authenticate requests.

Troubleshooting

  • No credentials got returned!
    This error occurs if the node cannot retrieve the necessary Kubernetes credentials. Ensure that the credentials are properly set up and linked to the node.

  • Command must be an array!
    When running pods or executing commands, the "Command" property must be a valid JSON array. Providing a different format will cause this error.

  • Resource not found or invalid namespace
    If the specified deployment name or namespace does not exist, the Kubernetes API will return an error. Verify that the resource name and namespace are correct.

  • Insufficient permissions
    The Kubernetes credentials used must have appropriate RBAC permissions to patch deployments in the target namespace.

Links and References

Discussion