Portainer icon

Portainer

Interact with Portainer via API

Actions190

Kubernetes → Get Kubernetes Metrics For Pod

AI-generated

Overview

This node operation retrieves Kubernetes metrics for a specific pod within a given namespace. It is useful for monitoring and analyzing the resource usage (such as CPU and memory) of individual pods in a Kubernetes cluster. Practical applications include performance monitoring, troubleshooting resource bottlenecks, and integrating pod metrics into automated workflows or dashboards.

Properties

Name Meaning
Id Environment identifier (a numeric ID representing the Kubernetes environment to query)
Namespace The Kubernetes namespace where the pod resides
Name The identifier (name) of the pod to retrieve metrics for

Output

The output contains JSON data representing the metrics of the specified pod. This typically includes resource usage statistics such as CPU and memory consumption. The exact structure depends on the Kubernetes metrics API response but generally provides detailed metrics per container within the pod.

No binary data output is indicated.

Dependencies

  • Requires access to a Kubernetes environment identified by the provided environment ID.
  • Needs appropriate API credentials or tokens configured in n8n to authenticate with the Kubernetes API server.
  • The node relies on Kubernetes Metrics API being enabled and accessible in the target cluster.

Troubleshooting

  • Common issues:

    • Invalid or missing environment identifier may cause failure to connect to the Kubernetes cluster.
    • Incorrect namespace or pod name will result in no data found or errors from the Kubernetes API.
    • Lack of permissions or disabled metrics API in the Kubernetes cluster can lead to authorization errors or empty responses.
  • Error messages:

    • "Pod not found" or similar indicates the specified pod name or namespace does not exist.
    • Authentication errors suggest misconfigured or missing API credentials.
    • Timeout or connection errors imply network issues or incorrect cluster endpoint configuration.

To resolve these, verify the environment ID, namespace, and pod name are correct; ensure the Kubernetes Metrics API is enabled; and confirm that valid credentials with sufficient permissions are set up in n8n.

Links and References

Discussion