Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node interacts with Kubernetes clusters to perform various operations on Kubernetes resources. Specifically, for the ReplicaSets resource and the Logs operation, it retrieves the logs of a specified ReplicaSet within a given namespace.

Common scenarios where this node is beneficial include:

  • Debugging and monitoring ReplicaSets by fetching their logs.
  • Automating log retrieval as part of CI/CD pipelines or operational workflows.
  • Integrating Kubernetes log data into broader automation or alerting systems.

For example, you can use this node to fetch logs from a ReplicaSet named "my-replicaset" in the "default" namespace to analyze its behavior or troubleshoot issues.

Properties

Name Meaning
Namespace The Kubernetes namespace where the ReplicaSet resides. Defaults to "default".
Resource Name The name of the ReplicaSet resource whose logs you want to retrieve.

Output

The node outputs JSON data containing the logs retrieved from the specified ReplicaSet. The exact structure depends on the Kubernetes API response but generally includes log lines or aggregated log content under the json output field.

If the node supports binary data output (not explicitly shown in the provided code), it would typically represent raw log files or streams; however, based on the static analysis, only JSON log data output is evident.

Dependencies

  • Requires an active connection to a Kubernetes cluster.
  • Needs an API authentication token or credentials configured in n8n to access the Kubernetes API.
  • 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 credentials in n8n. Ensure that the API key or authentication token is correctly set up.

  • Resource not found or empty logs:
    Verify that the specified namespace and ReplicaSet name are correct and that the ReplicaSet exists in the cluster.

  • Permission denied errors:
    The Kubernetes credentials used might lack permissions to read logs for ReplicaSets. Check RBAC settings in your cluster.

  • Empty or malformed command array (for other operations):
    Although not directly related to Logs, some operations require commands as arrays. Make sure JSON inputs are valid arrays when applicable.

Links and References

Discussion