Rancher icon

Rancher

Interact with Rancher/Kubernetes API

Overview

The "Upgrade" operation for the "Deployment" resource in this Rancher node allows users to update an existing Kubernetes deployment or statefulset by specifying a new container image and optionally updating environment variables. This operation is useful when you want to roll out a new version of your application or service running on a Kubernetes cluster managed via Rancher.

Common scenarios include:

  • Deploying a new version of a microservice by changing its Docker image.
  • Updating environment variables for configuration changes without redeploying the entire workload manually.
  • Automating continuous delivery pipelines where deployments are upgraded programmatically.

For example, you might use this node to upgrade a deployment named "web-app" in a specific namespace to use a new Docker image tag like myrepo/web-app:v2.0 and set environment variables such as LOG_LEVEL=debug.

Properties

Name Meaning
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. Depends on the selected cluster.
Namespace Name or ID (Optional) Select the namespace within the project. Depends on the selected project.
New Image The new Docker image to upgrade the deployment or statefulset to. Required.
Environment Variables Optional list of environment variables to set or update during the upgrade. Each variable has a name and value.

Output

The node outputs JSON data representing the result of the upgrade operation. This typically includes details about the updated deployment or statefulset resource as returned by the Rancher/Kubernetes API after applying the upgrade.

If the operation succeeds, the output JSON will contain the updated resource's metadata and status reflecting the new image and environment variables.

No binary data output is produced by this operation.

Dependencies

  • Requires access to a Rancher-managed Kubernetes cluster.
  • Requires an API authentication credential configured in n8n to authenticate with the Rancher API.
  • The node depends on dynamic loading of clusters, projects, namespaces, and deployments/statefulsets for selection options.
  • Proper RBAC permissions in the Kubernetes cluster to perform deployment upgrades.

Troubleshooting

  • Missing or invalid cluster/project/namespace: Ensure that the selected cluster, project, and namespace exist and are accessible with the provided credentials.
  • Invalid image format: The "New Image" property must be a valid Docker image reference. Errors may occur if the image string is malformed.
  • Permission denied errors: The API token used must have sufficient permissions to update deployments/statefulsets.
  • Empty or missing required fields: The "New Image" field is mandatory; leaving it empty will cause the operation to fail.
  • API connectivity issues: Network problems or incorrect Rancher API URL/credentials can cause failures connecting to the cluster.

To resolve errors, verify all input parameters, check API credentials, and ensure the Rancher server and Kubernetes cluster are reachable.

Links and References

Discussion