Kubernetes icon

Kubernetes

Consume Kubernetes API.

Overview

The node is designed to fetch Kubernetes events from a specified namespace. It supports both listing current events and optionally watching for changes in real-time. This functionality is useful for monitoring cluster activity, debugging issues, or triggering workflows based on specific event occurrences within Kubernetes.

Common scenarios include:

  • Retrieving recent events in a namespace to analyze pod lifecycle or error conditions.
  • Watching for new events to automate responses to cluster state changes.
  • Filtering events by labels or fields to focus on relevant resources.

For example, you might use this node to fetch the last 50 events in the "default" namespace or watch for any new warning events related to deployments.

Properties

Name Meaning
Namespace The Kubernetes namespace from which to retrieve events (e.g., "default").
Options A collection of optional parameters to customize the fetch operation:
- Allow Watch Bookmarks Boolean flag to allow watch bookmarks to be sent during watch operations.
- Continue String token to continue retrieving paginated results from a previous call.
- Field Selector String selector to filter events based on specific field values (e.g., involvedObject.name=pod1).
- Label Selector String selector to filter events based on label values (e.g., app=nginx).
- Limit Maximum number of event results to return (minimum 1, default 50).
- Pretty If set to true, the output JSON will be pretty printed for readability.
- Resource Version Specifies the resource version to start with for list/watch operations, enabling consistency in event retrieval.
- Resource Version Match Determines how the resourceVersion parameter is applied to list/watch calls.
- Send Initial Events When watching, if true, sends initial events immediately instead of waiting for changes.
- Timeout Seconds Timeout duration in seconds for the list or watch call (0 means no timeout).
- Watch Boolean flag indicating whether to watch for changes to the requested events instead of just listing them once.

Output

The node outputs a JSON object containing the fetched Kubernetes events. The structure typically includes metadata about the events, such as their type, involved objects, timestamps, and messages describing the event.

If the "Watch" option is enabled, the output may stream event updates as they occur.

No binary data output is indicated.

Dependencies

  • Requires access to a Kubernetes cluster API.
  • Needs appropriate authentication credentials (such as an API key or token) configured in n8n to connect securely to the Kubernetes API.
  • The node depends on internal modules (./actions/node.description and ./actions/router) for its description and routing logic.

Troubleshooting

  • Authentication errors: Ensure that the Kubernetes API credentials are correctly configured and have sufficient permissions to read events in the specified namespace.
  • Timeouts: If the request times out, consider increasing the "Timeout Seconds" property or verifying network connectivity to the Kubernetes API.
  • Empty results: Check that the namespace exists and contains events; also verify that label and field selectors are correctly specified.
  • Watch not working: Confirm that the "Watch" option is enabled and that the cluster supports watch operations on events.

Links and References

Discussion