Portainer icon

Portainer

Interact with Portainer via API

Actions190

Kubernetes → Get Kubernetes Namespaces

AI-generated

Overview

This node operation retrieves Kubernetes namespaces from a specified environment. It is useful for users who want to list all namespaces within a Kubernetes cluster, optionally including detailed resource quota information for each namespace. Practical applications include monitoring cluster organization, managing resources, or integrating namespace data into automation workflows.

Properties

Name Meaning
Id Environment identifier (a numeric ID) specifying which Kubernetes environment to query.
With Resource Quota Boolean option to include resource quota details in the namespace information. Options: true or false.

Output

The output JSON contains an array of Kubernetes namespaces retrieved from the specified environment. Each namespace object includes standard namespace metadata and, if requested, resource quota information associated with that namespace.

If the "With Resource Quota" property is set to true, the namespace objects will have additional fields detailing resource quotas, such as CPU, memory limits, and other resource constraints.

No binary data output is produced by this node operation.

Dependencies

  • Requires access to a Kubernetes environment identified by the provided environment ID.
  • Needs an API key credential configured in n8n to authenticate requests to the Kubernetes API or intermediary service managing Kubernetes environments.
  • The node uses HTTP requests with query parameters to fetch namespaces and optionally their resource quotas.

Troubleshooting

  • Common issues:

    • Invalid or missing environment ID can cause failure to retrieve namespaces.
    • Insufficient permissions or incorrect API credentials may result in authorization errors.
    • Network connectivity problems between n8n and the Kubernetes API endpoint can cause timeouts or connection failures.
  • Error messages:

    • Authorization errors typically indicate invalid or expired API keys; verify and update credentials.
    • "Namespace not found" or empty results may mean the environment ID does not correspond to any accessible Kubernetes cluster.
    • Query parameter errors might occur if the "With Resource Quota" value is malformed; ensure it is a boolean.

Links and References

Discussion