Portainer icon

Portainer

Interact with Portainer via API

Actions190

Kubernetes → Get Kubernetes Roles

AI-generated

Overview

This node operation retrieves Kubernetes Roles from a specified environment. It is useful for users who want to programmatically access and manage role-based access control (RBAC) configurations within their Kubernetes clusters. For example, a DevOps engineer might use this node to audit roles or integrate role information into automated workflows.

Properties

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

Output

The output will contain JSON data representing the Kubernetes Roles retrieved from the specified environment. Each item in the output corresponds to a role object with its associated metadata and permissions as defined in Kubernetes RBAC.

If the node supports binary data output, it would typically represent any attached files or manifests related to the roles, but based on the provided code snippet, only JSON output is expected.

Dependencies

  • Requires an API key credential to authenticate requests to the Portainer API.
  • The node interacts with the Portainer API endpoint configured via credentials, specifically targeting Kubernetes environments managed through Portainer.
  • The base URL for API requests is set dynamically from the user's credentials.

Troubleshooting

  • Common issues:

    • Invalid or missing environment identifier (Id property) will cause the request to fail.
    • Incorrect or expired API authentication token may result in authorization errors.
    • Network connectivity problems between n8n and the Portainer API server can cause timeouts or connection errors.
  • Error messages:

    • Authorization errors typically indicate invalid credentials; verify and update the API key.
    • "Environment not found" or similar errors suggest the provided Id does not correspond to a valid Kubernetes environment.
    • JSON parsing errors may occur if the API response format changes unexpectedly.

Links and References

Discussion