Portainer icon

Portainer

Interact with Portainer via API

Actions190

Kubernetes → Get Kubernetes Secrets Count

AI-generated

Overview

This node operation retrieves the count of Kubernetes Secrets within a specified environment. It is useful for monitoring and managing Kubernetes clusters by quickly obtaining the number of secrets stored, which can help in auditing, security checks, or resource management.

Practical examples include:

  • Quickly checking how many secrets exist in a particular Kubernetes environment before performing cleanup.
  • Monitoring secret counts as part of compliance or security workflows.
  • Integrating with dashboards to display current secret usage statistics.

Properties

Name Meaning
Id Environment identifier (a required numeric ID specifying which Kubernetes environment to query)

Output

The output JSON contains the count of Kubernetes Secrets found in the specified environment. The exact structure is not fully detailed in the provided code, but typically it would be an object with a property indicating the total number of secrets, for example:

{
  "count": 42
}

No binary data output is indicated.

Dependencies

  • Requires an API key credential to authenticate requests to the Portainer API or Kubernetes environment.
  • The node depends on the Portainer API endpoint configured via credentials, specifically the base URL and authentication token.
  • Uses the @devlikeapro/n8n-openapi-node package for OpenAPI integration.

Troubleshooting

  • Common issues:
    • Invalid or missing environment identifier (Id) will cause the request to fail.
    • Authentication errors if the API key or credentials are incorrect or expired.
    • Network connectivity issues to the Portainer or Kubernetes API endpoint.
  • Error messages:
    • Unauthorized or 401 errors indicate invalid credentials; verify and update the API key.
    • 404 or environment not found errors suggest the specified environment ID does not exist.
    • Timeout or connection errors may require checking network access or API availability.

Links and References

Discussion