Kubernetes Multi-cluster Federation
You set up kubernetes multi cluster federation by syncing roles and rules across your separate clusters. This setup lets one central plane push apps and rules to many clusters at once. Teams often copy broad admin roles to every cluster to save time during setup. When a role is too broad, one bad command can harm every linked cluster. How kubernetes multi cluster federation handles roles and permissions Each cluster in your fleet still runs its own local API server. You must enable role-based
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 kubernetes multi cluster federation by syncing roles and rules across your separate clusters. This setup lets one central plane push apps and rules to many clusters at once. Teams often copy broad admin roles to every cluster to save time during setup. When a role is too broad, one bad command can harm every linked cluster.
How kubernetes multi cluster federation handles roles and permissions
Each cluster in your fleet still runs its own local API server. You must enable role-based access control on each API server to check user requests. In this model, a Role or ClusterRole holds a list of allowed actions. These rules are purely additive, which means there are no deny rules at all. If you want to limit a team to one namespace, you create a Role. Then you link that Role to the team with a RoleBinding in that namespace. If a team needs reach across the whole cluster, you use a ClusterRole. A ClusterRole can cover cluster-wide items like nodes or span across all namespaces. You attach it with a ClusterRoleBinding to grant cluster-wide reach. You can also bind a ClusterRole inside one namespace with a local RoleBinding. In a federated setup, a central controller copies these role objects to each member cluster. The controller makes sure the right teams have the same permissions everywhere. It also handles subresources like pod logs or pod exec paths. The API server writes these subresources with a slash in the resource name.
Why native roles leave a gap during live sessions
Syncing roles across clusters solves the problem of who can log in where. It stops you from writing the same role files by hand on ten clusters. Still, native roles only check if a user can start an action. Once a user opens an exec session into a pod, RBAC steps back. The API server checks the pod exec subresource when the session starts. It does not check the shell commands the user runs inside that container. A developer with exec rights in three clusters can run any command inside those pods. They can read local files, dump memory, or pull customer data from an app. Native roles also cannot mask sensitive fields like emails, phone numbers, or card numbers. If a pod log prints a national ID, anyone with log read rights sees it. Plus, managing local credentials or kubeconfig files for every cluster creates a huge risk. Long-lived keys sitting on laptops can leak and give an attacker wide reach.
Managing multi-cluster workflows with least privilege
To keep your clusters safe, you should separate day-to-day checks from broad admin roles. Start by giving teams read-only roles in the namespaces they own. Avoid binding cluster-wide admin roles to human users across your federated fleet. Let your deployment tools push code updates while humans keep minimal rights. When an engineer needs to debug a live pod, scope that permission down tightly. You should still track what happens inside the session after the API server approves it. Good security requires knowing which commands ran and keeping raw data out of terminal outputs.
Kubernetes RBAC + Multi-Factor Authentication (MFA): architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
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
Does Kubernetes RBAC support deny rules across federated clusters?
No, Kubernetes RBAC rules are purely additive and never include deny rules. You must grant only the exact permissions a user needs in each Role or ClusterRole.
How is a Role different from a ClusterRole in a multi-cluster setup?
A Role applies only to a single namespace inside a cluster. A ClusterRole can cover cluster-scoped items like nodes or apply across all namespaces at once.
Can native RBAC block specific shell commands inside a pod exec session?
No, native RBAC only checks if a user has rights to the pod exec subresource. Once the shell opens, RBAC does not inspect or block individual commands inside the pod.
Related guides
In this post