How to Configure n8n Kubernetes Credentials

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up n8n kubernetes credentials by creating a cluster role and storing its token inside n8n. Then your workflow nodes or AI Agent tools send API calls to the cluster. Many teams start by pasting an admin token into the credential store to get workflows running fast. When a shared token holds wide cluster permissions, any workflow step can read secrets or delete workloads. How to set up n8n kubernetes credentials with RBAC A safe setup starts inside your cluster before you open the workf

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 credentials by creating a cluster role and storing its token inside n8n. Then your workflow nodes or AI Agent tools send API calls to the cluster. Many teams start by pasting an admin token into the credential store to get workflows running fast. When a shared token holds wide cluster permissions, any workflow step can read secrets or delete workloads.

How to set up n8n kubernetes credentials with RBAC

A safe setup starts inside your cluster before you open the workflow builder. Kubernetes RBAC uses roles to group rules that define allowed actions. These permissions are additive, which means there are no deny rules in RBAC. You choose between two role types based on what the workflow must touch.

A Role sets permissions inside one single namespace. A ClusterRole is not tied to one namespace and covers cluster-wide items like nodes. It can also grant rights to resources across all namespaces at once. Next, you bind that role to the identity that n8n will use.

A RoleBinding grants permissions inside one namespace by linking to a Role or ClusterRole. A ClusterRoleBinding grants access across the whole cluster. Once you create the binding, you copy the bearer token and cluster URL into n8n. In n8n, workflows or AI Agent nodes use tool sub-nodes to run tasks. An AI Agent node pairs a chat model with tools like the HTTP Request Tool. The agent decides which tool to call based on user input and sends the request.

Choosing between namespace roles and cluster roles

Most automation workflows only need to manage pods or jobs in one namespace. For these tasks, a namespace Role and RoleBinding keep the blast radius small. If a workflow fails or loops, it cannot harm other namespaces in the cluster.

Some teams need n8n to check node health or read pod logs across every namespace. In that case, a ClusterRole and ClusterRoleBinding fit the task better. RBAC refers to resources by the same name used in the API URL. Some APIs use subresources like pod logs or pod exec, written with a slash. If your workflow reads logs, you must grant access to the log subresource directly. Granting top-level pod rights alone does not cover subresources, and broad bindings expose every namespace.

Ephemeral Credentials + Kubernetes RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Where native n8n kubernetes credentials fall short

Native RBAC and static tokens solve the problem of who can log in to the API. They verify the identity of the n8n caller and check basic resource verbs. Still, static tokens live in the n8n store until an engineer rotates them by hand.

RBAC also cannot see what happens inside an allowed API call or command in flight. If a role allows pod exec or secret reads, any workflow using that credential can run them. An AI Agent node might pick a tool and run a destructive command inside a pod. The cluster API server sees a valid token and allows the call right away. Native RBAC also cannot mask sensitive fields like emails, phone numbers, card numbers, or national IDs in pod logs. When a workflow pulls logs or data, raw values flow straight into n8n execution history and model prompts.

Govern kubectl and API calls in flight

Identity providers and Kubernetes RBAC decide who logs into a cluster. They cannot redact keys inside returned JSON objects or hold a risky delete call for review. By design, hoop.dev runs as an open-source proxy, a sidecar for your Kubernetes API, checking requests and responses without replacing RBAC.

First, hoop.dev guardrails refuse banned methods, paths, or headers before they run. Next, hoop.dev data masking rewrites sensitive keys in returned Secret, ConfigMap, and log responses in memory, and writes each decision to the audit trail. Explore the repo on GitHub.

Frequently asked questions

Can Kubernetes RBAC block specific commands inside an n8n pod exec call?

No, Kubernetes RBAC only checks if the caller can use the pod exec subresource. Once the API server allows the call, RBAC cannot inspect or block the shell commands that run.

Should I use a Role or a ClusterRole for n8n workflows?

Use a Role and RoleBinding whenever your workflow works inside a single namespace. Only use a ClusterRole when the workflow must read cluster nodes or work across many namespaces.

How do AI Agent nodes in n8n use cluster credentials?

An AI Agent node connects a chat model to tool sub-nodes such as the HTTP Request Tool. The agent picks which tool to call and uses the stored credential to hit the cluster API.

The query runs. The emails stay hidden.