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 trigger alerts or automated responses when certain conditions occur.
  • Filtering events by labels or fields to focus on relevant resources.

For example, you could use this node to fetch the last 50 events in the "default" namespace or watch for any new 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/watch behavior:
- Allow Watch Bookmarks Whether to allow watch bookmarks to be sent (boolean).
- Continue Token to continue retrieving paginated results (string).
- Field Selector Filter events based on specific field values (string).
- Label Selector Filter events based on label values (string).
- Limit Maximum number of results to return (number, minimum 1, default 50).
- Pretty If true, output is pretty printed (string).
- Resource Version Version of the resource to start with for list/watch operations (string).
- Resource Version Match Determines how resourceVersion is applied to list/watch (string).
- Send Initial Events If true, sends initial events for watch instead of waiting for changes (boolean).
- Timeout Seconds Timeout for the list or watch call, in seconds (number, minimum 0).
- Watch If true, watch for changes to the requested resources instead of just listing (boolean).

Output

The node outputs JSON data representing the fetched Kubernetes events. The structure typically includes metadata about each event such as involved object, reason, message, timestamps, and type. If the watch option is enabled, the output may stream event updates as they occur.

If binary data were involved (not indicated here), it would represent raw event payloads or logs, but this node focuses on JSON event objects.

Dependencies

  • Requires access to a Kubernetes cluster API.
  • Needs appropriate authentication credentials configured in n8n to connect securely to the Kubernetes API.
  • No additional external services are required beyond Kubernetes itself.

Troubleshooting

  • Authentication errors: Ensure that the API credentials have sufficient permissions to list or watch events in the specified namespace.
  • Timeouts: If the request times out, consider increasing the "Timeout Seconds" option or verify network connectivity to the Kubernetes API.
  • Empty results: Check that the namespace exists and contains events; also verify label and field selectors for correctness.
  • Watch not receiving events: Confirm that "Watch" is enabled and that "Send Initial Events" is set appropriately if initial data is expected.

Links and References

Discussion