Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node allows interaction with Kubernetes clusters, specifically focusing on managing Pods when the "Pods" resource and "Scale" operation are selected. The Scale operation adjusts the number of pod replicas in a specified namespace, enabling dynamic scaling of applications running in Kubernetes.

Common scenarios where this node is beneficial include:

  • Automatically scaling up pods during high traffic periods.
  • Scaling down pods to save resources during low usage.
  • Integrating Kubernetes scaling into automated workflows or CI/CD pipelines.

For example, you could use this node to increase the number of replicas of a deployment from 2 to 5 before a scheduled event, then scale back down afterward.

Properties

Name Meaning
Namespace The Kubernetes namespace where the pod(s) reside. Defaults to "default".
Resource Name The name of the specific pod or deployment resource to scale.

Note: Although the bundled code supports many operations and resources, for the "Pods" resource and "Scale" operation, these two properties are relevant.

Output

The node outputs JSON data representing the result of the scale operation. This typically includes the updated state of the scaled resource, such as the new replica count and metadata about the pod or deployment after scaling.

No binary data output is indicated for this operation.

Dependencies

  • Requires valid Kubernetes API credentials configured in n8n to authenticate and interact with the cluster.
  • The node depends on an internal Kubernetes client utility (K8SClient) to perform API calls.
  • Proper network access to the Kubernetes API server is necessary.

Troubleshooting

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

  • Resource not found or invalid resource name
    If the specified resource name does not exist in the given namespace, the operation will fail. Verify the resource name and namespace.

  • Insufficient permissions
    The Kubernetes credentials used must have permission to scale pods or deployments. Lack of RBAC permissions can cause failures.

  • Invalid input values
    Make sure the namespace and resource name are correctly provided and correspond to existing Kubernetes objects.

Links and References

Discussion