How to Configure EKS RBAC

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up eks rbac, map cloud identities to Kubernetes roles and role bindings. These rules tell the cluster API server who can read or change resources. Platform teams often start by giving engineers broad cluster admin roles during setup. Over time, those wide permissions stay in place for daily work. One bad command or leaked key can then wipe out whole namespaces. How eks rbac works in your cluster Kubernetes uses a built-in role system to control every request to the API server. You turn

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 eks rbac, map cloud identities to Kubernetes roles and role bindings. These rules tell the cluster API server who can read or change resources. Platform teams often start by giving engineers broad cluster admin roles during setup. Over time, those wide permissions stay in place for daily work. One bad command or leaked key can then wipe out whole namespaces.

How eks rbac works in your cluster

Kubernetes uses a built-in role system to control every request to the API server. You turn this mode on at the API server level. All rules in this system only add permissions to a user or group. There are no deny rules in standard Kubernetes role setups. Every user starts with zero permissions until you bind a role to them.

You build permissions using two main objects called Role and ClusterRole. A Role sets rules inside one single namespace for your team. A ClusterRole is not tied to one single namespace. It can cover cluster-wide items like nodes or endpoints without resources. It can also cover namespaced items across every namespace at once.

After you write the rules, you attach them to users with bindings. A RoleBinding gives permissions inside one namespace to a user or group. It can point to a Role in that same namespace. You can also point a RoleBinding at a global ClusterRole. This neat trick lets you reuse one set of rules across many teams. A ClusterRoleBinding gives those permissions across the whole cluster at once.

Handling subresources like pod logs and exec

The API server checks permissions using the exact name in the request URL. Some Kubernetes APIs use subresources for tasks like reading pod logs or running commands. In your role rules, you write these with a slash after the main resource. For example, you must grant access to the pods log or exec subresource.

If you only grant read access to pods, users cannot view the logs. You must add a rule for the log subresource as well. The same rule applies when engineers open a shell inside a running container. They need permissions for the exec subresource to run commands inside a pod. Kubernetes also lets you lock rules down to specific resource names. Still, name limits on create actions only work on top-level resources, not subresources.

Azure RBAC + EKS Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native roles solve and where they fall short

Native roles do a great job of stopping unauthorized API calls at the door. You can keep junior staff out of production namespaces with simple bindings. You can also stop apps from reading secrets that belong to other teams. This setup solves the basic question of who can reach which cluster object.

Still, native role checks stop the moment the API server approves the request. Once a user gets exec permissions on a pod, the cluster steps back. Native roles cannot see or limit the shell commands run inside that container. An engineer with exec rights can read local files or dump memory variables.

The same gap exists when engineers read pod logs or query app databases. Native roles decide who can open the log stream or reach the pod. They do not inspect the data flowing back to the user screen. If logs hold emails, phone numbers, or card numbers, native roles send everything raw. Teams also struggle to manage hundreds of static binding files as staff change roles. You need a way to check commands in flight and mask sensitive output.

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 sits inline beside the API server as a sidecar for your Kubernetes API. For every production API call an agent or human sends, hoop.dev decides whether to pass, mask, block, or escalate it for review alongside RBAC.

With hoop.dev Kubernetes controls, guardrails allow listing Secret names while refusing reads of Secret data before execution, and 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

Can I write a deny rule in Kubernetes RBAC?

No, Kubernetes role permissions are only additive and do not support deny rules. To block an action, you must remove the binding that grants that permission.

What is the difference between a RoleBinding and a ClusterRoleBinding?

A RoleBinding grants permissions inside one specific namespace to a user or group. A ClusterRoleBinding grants permissions across all namespaces and cluster-scoped nodes at once.

How do I let developers read pod logs without giving full pod access?

Create a Role that grants read permissions specifically to the pods log subresource. Then attach that Role to the developer group using a namespace RoleBinding.

The query runs. The emails stay hidden.