Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node enables interaction with Kubernetes resources through various operations such as getting, listing, deleting, running pods, executing commands, patching, scaling, and more. Specifically for the StatefulSets resource with the Patch operation, it allows users to modify existing StatefulSet resources in a Kubernetes cluster by applying partial updates.

Common scenarios where this node is beneficial include:

  • Automating Kubernetes resource management within workflows.
  • Updating configurations or specifications of StatefulSets without redeploying them entirely.
  • Integrating Kubernetes control into CI/CD pipelines or operational automation.

For example, you might use this node to patch a StatefulSet to update container images, change environment variables, or adjust replica counts dynamically based on external triggers.

Properties

Name Meaning
Image The container image name used when running or patching pods related to the operation.
Namespace The Kubernetes namespace where the StatefulSet resource resides. Defaults to "default".
Resource Name The specific name of the StatefulSet resource to target for the patch operation.

Note: Although the bundled code supports many operations and properties, for the Patch operation on StatefulSets, these are the relevant input properties.

Output

The node outputs JSON data representing the result of the patch operation on the StatefulSet resource. This typically includes the updated resource's metadata and status as returned by the Kubernetes API after applying the patch.

If the operation involves running pods or executing commands (not directly relevant to patch), the output may also contain standard output (stdout) from those executions.

No binary data output is indicated for the Patch operation.

Dependencies

  • Requires access to a Kubernetes cluster with appropriate permissions to patch StatefulSet resources.
  • Needs an API authentication token or API key credential configured in n8n to authenticate against the Kubernetes API.
  • Uses an internal Kubernetes client utility (K8SClient) to communicate with the cluster.

Troubleshooting

  • No credentials got returned!
    This error occurs if the node cannot retrieve the required Kubernetes API credentials. Ensure that valid credentials are configured and selected in the node settings.

  • Command must be an array!
    While not directly related to Patch, this error appears if the command property is provided but is not a JSON array. For Patch operation, this is usually not applicable unless combined with other operations.

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

  • Invalid patch format
    The node expects the patch data to be correctly formatted according to Kubernetes API standards. Malformed patches will cause API errors.

Links and References

Discussion