Rancher icon

Rancher

Interact with Rancher/Kubernetes API

Overview

This node allows users to interact with the Rancher/Kubernetes API, specifically managing Kubernetes resources such as Pods. For the Pod Delete operation, it deletes a specified pod within a Kubernetes cluster. This is useful for scenarios where you need to programmatically remove pods that are no longer needed, stuck, or require replacement.

Practical examples include:

  • Automatically cleaning up failed or completed pods in a CI/CD pipeline.
  • Removing pods during scaling down operations or maintenance tasks.
  • Managing pod lifecycle as part of automated Kubernetes workflows.

Properties

Name Meaning
Cluster Name or ID Select the Kubernetes cluster where the pod resides. 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.
Pod ID The unique identifier of the pod to delete. This is required and must be provided as a string.

Output

The output is a JSON object representing the response from the Rancher/Kubernetes API after attempting to delete the pod. It typically contains status information about the deletion request, such as confirmation of deletion or error details if the operation failed.

No binary data output is produced by this operation.

Example output structure (conceptual):

{
  "status": "Success",
  "details": {
    "name": "pod-name",
    "namespace": "default",
    "message": "Pod deleted successfully"
  }
}

Dependencies

  • Requires an active connection to a Rancher or Kubernetes cluster via an API key credential configured in n8n.
  • The node depends on Rancher/Kubernetes API access permissions to delete pods.
  • The user must have appropriate RBAC permissions to delete pods in the specified namespace/project/cluster.

Troubleshooting

  • Common issues:

    • Insufficient permissions: The API token used may lack rights to delete pods in the target namespace.
    • Incorrect Pod ID: Providing a wrong or non-existent pod ID will cause the deletion to fail.
    • Network or connectivity problems with the Rancher/Kubernetes API endpoint.
  • Error messages:

    • "Pod not found": Verify the Pod ID and namespace are correct.
    • "Forbidden" or "Unauthorized": Check API credentials and RBAC permissions.
    • Timeout or connection errors: Ensure network connectivity and API endpoint availability.

Resolving these usually involves verifying input parameters, checking credentials, and ensuring the Kubernetes cluster is accessible.

Links and References

Discussion