How to Configure n8n Kubernetes MCP Server
To set up an n8n kubernetes mcp server, attach an MCP tool sub-node to an AI Agent node. Then bind that server to a scoped Kubernetes role with minimal cluster permissions. Platform teams often start by linking their workflow directly to a broad cluster role. This shortcut speeds up testing, because the agent can inspect pods, nodes, and logs right away. Still, broad permissions let a single prompt mistake delete workloads or read sensitive secrets across namespaces. Scoping roles properly is th
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.
To set up an n8n kubernetes mcp server, attach an MCP tool sub-node to an AI Agent node. Then bind that server to a scoped Kubernetes role with minimal cluster permissions. Platform teams often start by linking their workflow directly to a broad cluster role. This shortcut speeds up testing, because the agent can inspect pods, nodes, and logs right away. Still, broad permissions let a single prompt mistake delete workloads or read sensitive secrets across namespaces. Scoping roles properly is the first step toward safe automation.
How the n8n kubernetes mcp server architecture works
In n8n, the AI Agent node builds an agent from a chat model and connected tools. You must attach at least one tool sub-node so the agent can act. Starting in n8n 1.82.0, every AI Agent node runs as a Tools Agent by default. The old agent type setting was deprecated then and removed in version 3.0. During a run, the agent decides which attached tool to call to finish its task. N8n also provides a registry of MCP servers Alongside built-in workflow and HTTP tools. When the agent picks the Kubernetes tool, the MCP server translates the request into API calls.
On the cluster side, Kubernetes role-based access control governs what those API calls can do. A Role sets permissions inside one namespace, while a ClusterRole covers resources across the entire cluster. ClusterRoles can also govern cluster-scoped objects like nodes and non-resource endpoints. You then link these rules to the MCP server identity with a RoleBinding or ClusterRoleBinding. A RoleBinding grants permissions inside one namespace, even when it points to a shared ClusterRole. A ClusterRoleBinding grants those permissions across every namespace in the cluster. Kubernetes rules are purely additive, which means there are no deny rules to block specific actions. You must list every allowed resource and verb with care. Subresources like pod logs or pod exec paths require explicit slash notation in your role rules.
What native setup solves and where gaps remain
Setting up strict Roles and RoleBindings gives your team strong baseline control over cluster access. It stops an n8n workflow from touching namespaces or resource types outside its assigned scope. For example, you can grant read access to pod statuses in a single staging namespace. You can also omit pod exec subresources so the agent cannot open shells inside running containers. This native setup answers who can log in and which API groups they can reach.
Yet static role bindings leave an operational gap during live agent execution. Kubernetes RBAC checks the resource type and verb, not the context or payload of a request. Once a role allows reading pod logs or config maps, every matching object in that namespace flows back. Those logs often hold emails, phone numbers, card numbers, or national IDs from live user traffic. Standard cluster roles do not rewrite matched fields in results before the chat model reads them. Likewise, if an agent needs write permissions to restart failed pods, RBAC cannot pause one risky delete call. The cluster role allows the verb at all times without human review per command. Native logs also separate n8n workflow events from Kubernetes API audit entries. Teams must stitch together two different log streams to see why an agent ran a specific command.
Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Add request guardrails and response masking beside Kubernetes
Cluster roles and service accounts govern who reaches the Kubernetes API. Still, a broad role or agent can delete workloads or print sensitive values from ConfigMaps and logs. In practice, hoop.dev runs beside the API server as a sidecar for your Kubernetes API and checks every request and response alongside RBAC.
With hoop.dev Kubernetes controls, guardrails can allow listing Secret names while refusing reads of Secret data before execution. Data masking redacts matched keys in returned JSON responses and log streams in memory. Furthermore, hoop.dev holds SOC 2 Type II and is MIT licensed on GitHub.
Frequently asked questions
How does an n8n AI Agent node connect to MCP tools?
You attach a tool sub-node directly to the AI Agent node in your workflow canvas. Since n8n 1.82.0, all AI Agent nodes operate as Tools Agents and choose when to call attached tools.
Should I use a Role or a ClusterRole for an MCP server?
Use a Role with a RoleBinding whenever the agent only needs access to a single namespace. Use a ClusterRole only when the agent must inspect cluster-wide nodes or resources across all namespaces.
Can Kubernetes RBAC block specific sensitive fields inside pod logs?
No, Kubernetes RBAC is purely additive and only controls access to the log subresource itself. It cannot inspect log text or rewrite sensitive data like emails or card numbers in flight.
Related guides
In this post