Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node enables interaction with Kubernetes resources, specifically supporting operations such as getting, listing, deleting, running pods, and more. For the StatefulSets resource with the Get operation, it retrieves detailed information about one or multiple StatefulSet resources within a specified Kubernetes namespace.

Common scenarios where this node is beneficial include:

  • Fetching the current state and metadata of StatefulSets to monitor application deployments.
  • Filtering StatefulSets by name, labels, or fields to target specific workloads.
  • Integrating Kubernetes StatefulSet data into automation workflows for reporting or conditional logic.

Practical example:

  • Retrieve details of a StatefulSet named my-statefulset in the production namespace to check its status before performing an update.

Properties

Name Meaning
Namespace The Kubernetes namespace where the StatefulSet resides. Defaults to "default".
Resource Name The exact name of the StatefulSet resource to retrieve. If provided, the query filters to this specific StatefulSet.
Field Selector A field selector string to filter StatefulSets based on resource fields (e.g., metadata.name=my-statefulset).
Label Selector A label selector string to filter StatefulSets based on labels (e.g., app=nginx).

Output

The output is a JSON array containing the retrieved StatefulSet resource(s) data from the Kubernetes API. Each item corresponds to one StatefulSet object, including all standard Kubernetes metadata and spec fields.

Example structure snippet:

[
  {
    "apiVersion": "apps/v1",
    "kind": "StatefulSet",
    "metadata": {
      "name": "my-statefulset",
      "namespace": "production",
      "labels": { ... },
      ...
    },
    "spec": { ... },
    "status": { ... }
  }
]

No binary data output is produced by this operation.

Dependencies

  • Requires valid Kubernetes API credentials configured in n8n to authenticate requests.
  • Depends on the Kubernetes cluster being accessible from the n8n environment.
  • Uses an internal Kubernetes client utility to perform API calls.

Troubleshooting

  • No credentials got returned!
    This error indicates missing or misconfigured Kubernetes API credentials. Ensure that the node has proper access credentials set up.

  • Command must be an array!
    Although not relevant for the Get operation, this error may appear if the node is used with the Run operation and the command input is incorrectly formatted.

  • Resource not found or empty response
    If specifying a resource name or selectors returns no data, verify that the StatefulSet exists in the given namespace and that selectors are correctly formed.

  • Connection errors
    Network issues or incorrect Kubernetes API endpoint configuration can cause failures. Confirm connectivity and credential validity.

Links and References

Discussion