Portainer icon

Portainer

Interact with Portainer via API

Actions190

Kubernetes → Get Kubernetes Services By Namespace

AI-generated

Overview

This node operation retrieves Kubernetes services within a specified namespace. It is useful for users who want to list or inspect the services running in a particular Kubernetes namespace, enabling management and monitoring of service resources programmatically within n8n workflows.

Practical examples include:

  • Automating audits of services deployed in different namespaces.
  • Triggering workflows based on the presence or status of specific services.
  • Integrating Kubernetes service data into dashboards or reporting tools.

Properties

Name Meaning
Id Environment identifier (number)
Namespace Namespace name (string)
  • Id: Represents the environment identifier where the Kubernetes cluster is configured or targeted.
  • Namespace: Specifies the Kubernetes namespace from which to retrieve the services.

Output

The output will contain JSON data representing the list of Kubernetes services found in the specified namespace. Each item typically includes details such as service names, labels, selectors, ports, and other metadata relevant to Kubernetes services.

If the node supports binary data output (not evident from the provided code), it would generally represent raw service manifests or related files, but this is not indicated here.

Dependencies

  • Requires access to a Kubernetes environment identified by the provided environment ID.
  • The node likely depends on an API connection or credentials configured in n8n to authenticate and communicate with the Kubernetes cluster.
  • No explicit external libraries or environment variables are shown in the snippet, but proper Kubernetes API access configuration is necessary.

Troubleshooting

  • Common issues:

    • Invalid or missing environment identifier may cause failure to connect to the Kubernetes cluster.
    • Incorrect namespace name can result in empty results or errors if the namespace does not exist.
    • Insufficient permissions on the Kubernetes API may lead to authorization errors.
  • Error messages:

    • Errors related to authentication or connectivity usually indicate misconfigured credentials or network issues.
    • "Namespace not found" or similar errors suggest the specified namespace does not exist in the target cluster.
  • Resolutions:

    • Verify that the environment ID corresponds to a valid and accessible Kubernetes cluster.
    • Confirm the namespace exists and is spelled correctly.
    • Ensure the API credentials have sufficient permissions to list services in the namespace.

Links and References

Discussion