Rancher icon

Rancher

Interact with Rancher/Kubernetes API

Overview

The Rancher node allows interaction with the Rancher/Kubernetes API to manage various Kubernetes resources. Specifically, for the Deployment resource with the Scale operation, this node enables users to adjust the number of replicas (pods) running in a deployment. This is useful for scaling applications up or down based on demand, such as increasing replicas during high traffic periods or reducing them to save resources.

Practical examples:

  • Automatically scale a web application deployment from 2 to 5 replicas during peak hours.
  • Scale down a batch processing deployment to zero replicas when no jobs are scheduled.

Properties

Name Meaning
Replicas Number of replicas to set for the deployment (e.g., 3 means three pods will run).
Cluster Name or ID Select the Kubernetes cluster where the deployment exists. Can be chosen from a list or specified via expression.
Project Name or ID (Optional) Select the project within the cluster. Can be chosen from a list or specified via expression.
Namespace Name or ID (Optional) Select the namespace within the project. Can be chosen from a list or specified via expression.
Deployment ID The unique identifier of the deployment to scale. Must be selected from a list or specified via expression.

Output

The node outputs JSON data representing the result of the scale operation on the deployment. This typically includes details about the updated deployment state, such as the new replica count and metadata confirming the scaling action.

No binary data output is involved in this operation.

Dependencies

  • Requires an active connection to a Rancher or Kubernetes API endpoint.
  • Needs an API authentication token or API key credential configured in n8n to authorize requests.
  • The node depends on dynamic loading methods to fetch clusters, projects, namespaces, and deployments for selection inputs.

Troubleshooting

  • Common issues:

    • Incorrect or missing cluster/project/namespace/deployment identifiers can cause failures.
    • Insufficient permissions on the Kubernetes cluster may prevent scaling operations.
    • Network connectivity problems to the Rancher/Kubernetes API endpoint.
  • Error messages and resolutions:

    • "Deployment not found": Verify that the deployment ID is correct and exists in the specified namespace/project/cluster.
    • "Unauthorized" or "Forbidden": Check API credentials and ensure the user has permission to scale deployments.
    • Timeout or connection errors: Confirm network access to the Kubernetes API server and that the cluster is reachable.

Links and References

Discussion