Rancher icon

Rancher

Interact with Rancher/Kubernetes API

Overview

This node allows interaction with the Rancher/Kubernetes API to manage various Kubernetes resources. Specifically, for the Pod resource with the Get operation, it retrieves information about one or more pods within a specified cluster, project, and namespace.

Common scenarios where this node is beneficial include:

  • Monitoring pod status and metadata in a Kubernetes environment.
  • Automating workflows that require fetching pod details for further processing or decision-making.
  • Integrating Kubernetes pod data into broader automation pipelines.

For example, you might use this node to fetch all pods running in a particular namespace of a cluster to check their health or to trigger alerts if certain pods are not running as expected.

Properties

Name Meaning
Cluster Name or ID Select the Kubernetes cluster by name or ID where the pod resides.
Project Name or ID (Optional) Select the project within the cluster.
Namespace Name or ID (Optional) Select the namespace within the project to narrow down the pod search.

These properties allow you to specify the scope within which to get pod information. The cluster selection is mandatory, while project and namespace are optional filters.

Output

The output is an array of JSON objects representing the pod(s) retrieved from the Rancher/Kubernetes API. Each object contains detailed information about a pod, such as its metadata, status, containers, labels, and other Kubernetes pod attributes.

The node does not output binary data for this operation.

Example structure of a single pod JSON output (simplified):

{
  "metadata": {
    "name": "pod-name",
    "namespace": "default",
    "labels": {
      "app": "my-app"
    },
    "creationTimestamp": "2024-01-01T00:00:00Z"
  },
  "status": {
    "phase": "Running",
    "podIP": "10.1.2.3",
    "containerStatuses": [
      {
        "name": "container-name",
        "ready": true,
        "restartCount": 0
      }
    ]
  },
  "spec": {
    "containers": [
      {
        "name": "container-name",
        "image": "nginx:latest",
        "ports": [
          {
            "containerPort": 80
          }
        ]
      }
    ]
  }
}

Dependencies

  • Requires 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 the Rancher/Kubernetes API being accessible and properly configured with the necessary permissions to read pod information.

Troubleshooting

  • Common issues:

    • Incorrect cluster, project, or namespace IDs may result in no pods found or errors.
    • Insufficient permissions on the API token can cause authorization failures.
    • Network connectivity issues to the Rancher/Kubernetes API will prevent successful calls.
  • Error messages:

    • "Unauthorized" or "Forbidden": Check that the API credentials have sufficient permissions.
    • "Not Found": Verify that the cluster, project, and namespace identifiers are correct.
    • Timeouts or connection errors: Ensure network access to the Rancher/Kubernetes API endpoint.

Resolving these typically involves verifying credentials, checking resource identifiers, and ensuring network connectivity.

Links and References

Discussion