Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node enables interaction with Kubernetes clusters, specifically focusing on managing Pods when the "Pods" resource and "Logs" operation are selected. It allows users to retrieve logs from specified pods within a Kubernetes namespace. This is useful for debugging, monitoring, or auditing containerized applications running in Kubernetes.

Common scenarios include:

  • Fetching real-time or historical logs from a pod to diagnose issues.
  • Integrating Kubernetes pod logs into automated workflows for alerting or analysis.
  • Collecting logs from specific pods filtered by namespace and name.

Example: Retrieve logs from a pod named my-app-pod in the default namespace to analyze application errors.

Properties

Name Meaning
Namespace The Kubernetes namespace where the pod resides. Defaults to "default".
Resource Name The name of the pod from which to fetch logs.

Output

The node outputs JSON data containing the logs retrieved from the specified pod. The exact structure depends on the Kubernetes API response but generally includes log lines as strings or arrays of strings representing the pod's stdout/stderr output.

If binary data were involved (e.g., raw log files), it would be indicated here, but this node focuses on textual log output.

Dependencies

  • Requires an active connection to a Kubernetes cluster.
  • Needs an API authentication token or credentials configured in n8n to access the Kubernetes API securely.
  • The node uses a Kubernetes client utility internally to communicate with the cluster.

Troubleshooting

  • No credentials got returned!
    This error indicates missing or misconfigured Kubernetes API credentials in n8n. Ensure that valid credentials are set up and linked to the node.

  • Pod not found or inaccessible
    If the specified pod name or namespace is incorrect, the node will fail to retrieve logs. Verify the pod exists and the namespace is correct.

  • Command must be an array!
    Although not directly related to the Logs operation, this error can occur if the "command" property is incorrectly formatted for operations like "run". For Logs, ensure only relevant properties are set.

  • Network or permission issues
    Connectivity problems or insufficient permissions in Kubernetes RBAC may prevent log retrieval. Confirm network access and proper role bindings.

Links and References

Discussion