Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node allows interaction with Kubernetes resources, specifically supporting a variety of operations including scaling StatefulSets. When using the Scale operation on the StatefulSets resource, the node adjusts the number of replicas for a given StatefulSet within a specified namespace.

Common scenarios where this node is beneficial include:

  • Dynamically adjusting the number of pods in a StatefulSet to handle varying workloads.
  • Automating scaling actions as part of CI/CD pipelines or operational workflows.
  • Managing Kubernetes resources programmatically without direct kubectl commands.

For example, you can use this node to scale a StatefulSet named my-database in the production namespace from 3 replicas to 5 replicas during peak usage hours.

Properties

Name Meaning
Namespace The Kubernetes namespace where the StatefulSet resides. Defaults to "default".
Resource Name The name of the StatefulSet resource to scale.

Note: The node also requires selecting the Scale operation and the StatefulSets resource (as per your selection).

Output

The node outputs JSON data representing the result of the scale operation. This typically includes the updated StatefulSet object or status information returned by the Kubernetes API after scaling.

The output is structured as an array of JSON objects, each corresponding to an input item processed. Each object contains details about the scaled StatefulSet, such as its metadata and current replica count.

No binary data output is produced by this operation.

Dependencies

  • Requires valid Kubernetes API credentials configured in n8n to authenticate and interact with the cluster.
  • The node depends on a Kubernetes client utility internally to perform API calls.
  • Proper RBAC permissions must be granted to the credentials used, allowing scaling of StatefulSets in the target namespace.

Troubleshooting

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

  • Resource not found or unauthorized
    If the specified StatefulSet name or namespace does not exist or the credentials lack permission, the operation will fail. Verify the resource name, namespace, and RBAC settings.

  • Invalid input values
    Make sure the Namespace and Resource Name fields are correctly set and non-empty when required.

  • API errors related to scaling
    These may occur if the requested replica count is invalid or conflicts with cluster policies. Check Kubernetes logs and events for more details.

Links and References

Discussion