Portainer icon

Portainer

Interact with Portainer via API

Actions190

Kubernetes → Get Kubernetes Secret

AI-generated

Overview

This node operation retrieves details of a specific Kubernetes Secret from a given namespace within a Kubernetes cluster. It is useful when you need to access sensitive configuration data or credentials stored as secrets in Kubernetes, for example, fetching database passwords or API keys managed securely by Kubernetes.

Practical examples include:

  • Automating deployment workflows that require secret values.
  • Auditing or verifying the contents of secrets during CI/CD pipelines.
  • Integrating Kubernetes secrets into other systems or services without manual intervention.

Properties

Name Meaning
Id Environment identifier (a numeric ID representing the Kubernetes environment to target)
Namespace The Kubernetes namespace where the secret is located
Secret The name of the Kubernetes secret to retrieve

Output

The node outputs JSON data containing the details of the requested Kubernetes Secret. This typically includes metadata about the secret and its data fields encoded in base64 format. The output structure corresponds to the Kubernetes API response for a secret resource.

If the secret contains binary data, it will be included in the output as base64-encoded strings under the data field.

Dependencies

  • Requires access to a Kubernetes cluster with appropriate permissions to read secrets.
  • Needs an API authentication token or credential configured in n8n to authenticate requests against the Kubernetes API server.
  • The node depends on the Kubernetes API being accessible from the n8n environment.

Troubleshooting

  • Common issues:

    • Invalid or missing namespace or secret name will result in errors indicating the resource was not found.
    • Insufficient permissions may cause authorization errors when attempting to read secrets.
    • Network connectivity problems between n8n and the Kubernetes API server can cause request failures.
  • Error messages and resolutions:

    • "Secret not found" — Verify the namespace and secret name are correct.
    • "Unauthorized" or "Forbidden" — Check that the API token or credentials have permission to read secrets in the specified namespace.
    • Timeout or connection errors — Ensure network access to the Kubernetes API endpoint is available and correctly configured.

Links and References

Discussion