Rancher27 icon

Rancher27

Interact with Rancher/Kubernetes API

Actions40

Overview

This node interacts with the Rancher/Kubernetes API to perform various operations on Kubernetes resources. Specifically, for the Pod resource with the Get Logs operation, it retrieves logs from a specified pod within a Kubernetes cluster. This is useful for monitoring and debugging applications running inside pods by accessing their log output.

Common scenarios include:

  • Fetching recent logs of a pod to diagnose issues.
  • Retrieving previous terminated container logs to understand crash reasons.
  • Following live log streams for real-time monitoring during deployments or troubleshooting.

Example use case:

  • A DevOps engineer wants to check the last 100 lines of logs from a specific container in a pod to investigate an error reported by users.

Properties

Name Meaning
Cluster Name or ID Select the Kubernetes cluster where the pod resides.
Project Name or ID Select the project within the cluster.
Namespace Name or ID Select the namespace containing the pod.
Pod ID The identifier of the pod to retrieve logs from.
Container (Optional) The name of the container inside the pod. If not specified, the first container is used.
Log Options Collection of options to customize log retrieval:
- Previous Boolean flag to return logs from the previously terminated container.
- Since Seconds Return logs newer than this relative duration (e.g., 5 seconds, 2 minutes).
- Tail Lines Number of lines from the end of the logs to show.
- Follow Boolean flag to follow the log stream continuously (stream logs in real-time).

Output

The node outputs JSON data containing the retrieved pod logs. The exact structure depends on the Rancher/Kubernetes API response but generally includes:

  • The log content as a string or stream.
  • Metadata about the pod and container may be included depending on the API response.

If the "Follow" option is enabled, the node streams logs continuously until stopped.

No binary data output is indicated for this operation.

Dependencies

  • Requires access to a Rancher or Kubernetes cluster via the Rancher/Kubernetes API.
  • Needs an API authentication token or API key credential configured in n8n to authenticate requests.
  • The node dynamically loads clusters, projects, and namespaces for selection, so these must be accessible via the API.

Troubleshooting

  • Missing or invalid cluster/project/namespace: Ensure the selected cluster, project, and namespace exist and are accessible with the provided credentials.
  • Pod not found: Verify the Pod ID is correct and that the pod exists in the specified namespace.
  • Permission errors: The API token must have sufficient permissions to read pod logs.
  • Log streaming issues: When using the "Follow" option, network interruptions can cause the stream to stop; ensure stable connectivity.
  • Empty logs: If no logs appear, confirm the pod has generated logs and the container name (if specified) is correct.

Links and References

Discussion