How to Configure n8n Kubernetes Permissions
You set up n8n kubernetes permissions by binding a Kubernetes role to your n8n account. This role holds additive rules that list the exact cluster actions your workflow can run. Teams often attach broad cluster roles to get workflows running fast. When permissions are too wide, one bad workflow or agent prompt can harm the whole cluster. How n8n kubernetes permissions work in a cluster In n8n, workflows and AI Agent nodes call tools to finish tasks. An AI Agent node combines a chat model with
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up n8n kubernetes permissions by binding a Kubernetes role to your n8n account. This role holds additive rules that list the exact cluster actions your workflow can run. Teams often attach broad cluster roles to get workflows running fast. When permissions are too wide, one bad workflow or agent prompt can harm the whole cluster.
How n8n kubernetes permissions work in a cluster
In n8n, workflows and AI Agent nodes call tools to finish tasks. An AI Agent node combines a chat model with one or more tool sub-nodes. The agent decides which tool to call during a run. Teams use an HTTP Request Tool, a Custom Code Tool, or an MCP server for cluster tasks. You can also use a Call n8n Workflow Tool to run helper flows.
When n8n talks to the Kubernetes API, the API server checks RBAC rules. In Kubernetes RBAC, a Role or ClusterRole holds a set of additive rules. There are no deny rules in this system. You start with zero access and add the exact verbs and resources n8n needs.
A Role sets permissions inside one namespace. A RoleBinding grants those permissions to the n8n account inside that same namespace. A RoleBinding can link to a Role in that namespace or a shared ClusterRole. A ClusterRole covers cluster-wide resources like nodes, or namespaced resources across all namespaces. A ClusterRoleBinding grants that access across the whole cluster.
For n8n workflows, start with a Role and RoleBinding in one namespace. Only use a ClusterRoleBinding when n8n must manage nodes or read across every namespace. If n8n needs pod logs or pod exec, you must grant access to subresources. Kubernetes RBAC names these subresources with a slash, such as pods and log or pods and exec.
What native RBAC solves and what it misses
Native Kubernetes RBAC solves the basic identity problem at the cluster door. It checks which account is calling the API and which resource types it can touch. By keeping n8n inside one namespace with a RoleBinding, you limit blast radius across namespaces.
Still, static RBAC rules only check who logs in and which API path they hit. RBAC does not inspect what individual commands, payloads, or agent requests do in flight. Once a workflow has exec access to pods, RBAC cannot filter the shell commands inside. If a workflow can read pod logs or secrets, RBAC does not mask sensitive output.
Kubernetes RBAC + AI Agent Permissions: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
This gap grows when an n8n AI Agent node picks tools on its own. Every tool sub-node attached to the agent shares the credentials and permissions configured for that workflow. If an agent gets tricked by bad input, it can run dangerous actions inside allowed namespaces. It might delete active pods, run bad shell scripts, or pull raw phone numbers from logs.
Scoping subresources and agent tool actions
To reduce risk with native tools, split your n8n workflows by task risk. Do not put read-only check tools and write tools on the same AI Agent node. Give your read workflows a Role that only allows get and list on pods. Keep pod log access separate from pod exec access in your role rules.
Remember that Kubernetes RBAC permissions are purely additive. If you bind two roles to the same n8n identity, it gets the sum of both. Create separate identities for different n8n workflows when tasks require high privileges. Even with tight roles, native RBAC cannot require human approval for a single API call. It also cannot rewrite sensitive fields like emails or card numbers in tool results.
Check Kubernetes API requests and responses on the wire
Kubernetes RBAC decides who may call the API server. RBAC does not check response payloads or split listing Secret names from reading Secret values when a role grants get access. With hoop.dev, you run an open-source HTTP proxy, a sidecar for your Kubernetes API. The kubectl client changes only the server address it talks to while RBAC stays in place.
On each call, hoop.dev guardrails read the method, normalized path, and headers to refuse bad deletes or full Secret reads with a 403 error. On the way back, hoop.dev data masking walks JSON responses by key and masks matched values in Secrets, ConfigMaps, and pod logs. Every request and verdict is logged without storing bearer tokens. View the project on GitHub.
Frequently asked questions
Should I use a Role or a ClusterRole for n8n workflows?
Use a Role and a RoleBinding when n8n only works inside a single namespace. Use a ClusterRole and ClusterRoleBinding only when n8n must reach nodes or all namespaces.
How do I let n8n read pod logs without full pod control?
Grant permissions on the pods log subresource in your Role rules. Do not grant the exec subresource or delete verbs unless the workflow needs them.
Can Kubernetes RBAC block specific shell commands inside a pod exec call?
No, Kubernetes RBAC only checks if the account can call the exec subresource on the pod. It does not inspect or block the shell commands that run inside the session.
Related guides
In this post