Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node enables interaction with Kubernetes clusters by performing various operations on Kubernetes resources. Specifically for the CronJobs resource and the Logs operation, it retrieves logs from a specified CronJob within a given namespace.

Common scenarios where this node is beneficial include:

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

For example, you can use this node to fetch logs from a CronJob named daily-backup in the default namespace to analyze its execution output or troubleshoot failures.

Properties

Name Meaning
Namespace The Kubernetes namespace where the CronJob resides. Defaults to "default".
Resource Name The name of the specific CronJob resource to retrieve logs from.

Output

The node outputs JSON data containing the logs retrieved from the specified CronJob. The structure typically includes standard output (stdout) content from the CronJob's pods or jobs.

If the node supports binary data output (not explicitly shown for Logs operation), it would represent raw log files or streamed log content.

Dependencies

  • Requires access to a Kubernetes cluster with appropriate permissions to read logs from CronJobs.
  • Needs an API authentication token or API key credential configured in n8n to authenticate against the Kubernetes API.
  • The node depends on an internal Kubernetes client utility (K8SClient) to interact with the Kubernetes API.

Troubleshooting

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

  • Resource not found or empty logs:
    Verify that the specified namespace and CronJob name exist and that the CronJob has generated logs. Also, check RBAC permissions to ensure the credentials allow reading logs.

  • Command must be an array! (relevant for other operations like run)
    When running commands, ensure the command input is a valid JSON array.

Links and References

Discussion