Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node enables interaction with Kubernetes clusters by performing various operations on Kubernetes resources. Specifically, for the Namespaces - Get operation, it retrieves information about one or more namespaces in a Kubernetes cluster. This is useful for scenarios where you need to programmatically query namespace details, such as listing all namespaces, filtering namespaces by labels or fields, or fetching a specific namespace by name.

Practical examples include:

  • Automating monitoring workflows that check the status or existence of namespaces.
  • Integrating Kubernetes namespace data into dashboards or reports.
  • Filtering namespaces based on labels or metadata for targeted automation tasks.

Properties

Name Meaning
Namespace The Kubernetes namespace context to operate within. Defaults to "default".
Resource Name The exact name of the resource (namespace) to retrieve. If provided, the node fetches this specific namespace.
Field Selector A field selector string to filter namespaces based on their fields. See Kubernetes Field Selectors.
Label Selector A label selector string to filter namespaces based on labels. See Kubernetes Labels.

Output

The output is a JSON array containing the retrieved namespace(s) data from the Kubernetes API. Each item corresponds to a namespace object with its full metadata and status as returned by Kubernetes.

Example structure of each JSON item:

{
  "apiVersion": "v1",
  "kind": "Namespace",
  "metadata": {
    "name": "example-namespace",
    "labels": { ... },
    "annotations": { ... },
    ...
  },
  "status": {
    "phase": "Active"
  }
}

No binary data is output 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 perform API calls.
  • 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 or no results returned
    Check if the Resource Name, Field Selector, or Label Selector filters are correctly specified. Incorrect selectors may result in no matching namespaces.

  • API connection errors
    Verify network connectivity to the Kubernetes API server and that the credentials have sufficient permissions to read namespaces.

Links and References

Discussion