Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

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

Common scenarios where this node is beneficial include:

  • Debugging and monitoring services by fetching their logs.
  • Automating log retrieval as part of CI/CD pipelines or incident response workflows.
  • Integrating Kubernetes service logs into broader observability or alerting systems.

For example, you can use this node to fetch logs from a specific service in the "default" namespace to analyze recent activity or troubleshoot issues.

Properties

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

Output

The node outputs JSON data representing the logs retrieved from the specified Kubernetes service. The exact structure depends on the Kubernetes API response but generally includes log lines or log metadata.

If binary data were involved (e.g., raw log files), it would be indicated here, but this node returns textual log data in JSON format.

Dependencies

  • Requires access to a Kubernetes cluster with appropriate permissions.
  • Needs an API authentication token or credentials configured in n8n to connect securely to the Kubernetes API.
  • Uses an internal Kubernetes client utility (K8SClient) to interact with the cluster.

Troubleshooting

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

  • Command must be an array! (relevant for other operations like run)
    If you switch operations, ensure that commands provided are valid JSON arrays.

  • Logs not found or empty output
    Verify that the service name and namespace are correct and that the service is generating logs. Also, check Kubernetes cluster connectivity and permissions.

Links and References

Discussion