Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node interacts with Kubernetes clusters to perform various operations on Kubernetes resources. Specifically, for the Jobs resource with the List operation, it retrieves a list of Kubernetes Job objects from a specified namespace. Users can filter the listed jobs using field selectors or label selectors to narrow down results based on metadata or labels.

Common scenarios where this node is beneficial include:

  • Monitoring and managing batch jobs running in Kubernetes.
  • Automating workflows that depend on the status or existence of certain jobs.
  • Integrating Kubernetes job data into broader automation pipelines.

For example, you might use this node to list all jobs in the "default" namespace that have a specific label indicating they belong to a particular application, then trigger downstream processes based on their status.

Properties

Name Meaning
Namespace The Kubernetes namespace from which to list Jobs. Defaults to "default".
Resource Name (Optional) The exact name of a Job resource to retrieve. If provided, the listing will be filtered to this specific Job.
Field Selector A Kubernetes field selector string to filter Jobs by specific fields (e.g., metadata.name=job1). See Kubernetes Field Selectors for details.
Label Selector A Kubernetes label selector string to filter Jobs by labels (e.g., app=myapp). See Kubernetes Labels for details.

Output

The output is a JSON array containing the Kubernetes Job objects matching the query parameters. Each item corresponds to one Job resource and includes its full metadata and status as returned by the Kubernetes API.

The structure of each JSON object reflects the standard Kubernetes Job resource schema, including fields such as:

  • metadata: Information like name, namespace, labels, annotations.
  • spec: The specification of the job.
  • status: Current status information about the job execution.

No binary data output is produced by this operation.

Dependencies

  • Requires valid Kubernetes API credentials configured in n8n to authenticate and communicate with the Kubernetes cluster.
  • The node depends on an internal Kubernetes client utility (K8SClient) to interact with the Kubernetes API.
  • Proper network access to the Kubernetes API server is necessary.

Troubleshooting

  • No credentials got returned!
    This error indicates missing or misconfigured Kubernetes API credentials. Ensure that the node has been provided with valid authentication details.

  • Empty result set
    If no jobs are returned, verify that the namespace is correct and that any field or label selectors are properly formatted and match existing jobs.

  • Invalid field selector or label selector syntax
    Incorrect selector strings may cause the API to reject the request or return no results. Refer to Kubernetes documentation for correct selector syntax.

  • Permission errors
    Insufficient permissions for the provided credentials can lead to authorization errors. Confirm that the credentials have rights to list Jobs in the target namespace.

Links and References

Discussion