How to Configure EKS Pod Security
You set up eks pod security by defining Kubernetes roles and bindings for each namespace. You also restrict container privileges and limit who can run commands inside live pods. Most engineering teams start by mapping cloud identities to broad cluster roles. When those roles are too wide, any developer can read secrets or change live workloads. A clear role plan keeps users inside their own namespaces and limits pod entry. How eks pod security works with native roles Kubernetes controls user
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 eks pod security by defining Kubernetes roles and bindings for each namespace. You also restrict container privileges and limit who can run commands inside live pods. Most engineering teams start by mapping cloud identities to broad cluster roles. When those roles are too wide, any developer can read secrets or change live workloads. A clear role plan keeps users inside their own namespaces and limits pod entry.
How eks pod security works with native roles
Kubernetes controls user actions through role-based rules on the API server. Every rule in this system is additive, which means there are no deny rules. You start with zero permissions and add rules for each needed action. A basic Role sets permissions inside one single namespace. A ClusterRole sets permissions across the whole cluster, including nodes and all namespaces.
To give those permissions to a user, you create a binding. A RoleBinding grants permissions inside one namespace and can point to a Role. A RoleBinding can also point to a shared ClusterRole to save time. A ClusterRoleBinding grants permissions across every namespace at once. Teams keep pod setups safe by favoring single-namespace bindings over cluster-wide ones.
Pod entry and log viewing use special subresources in the API. Kubernetes writes these subresources with a slash, such as the pod log path. Another subresource controls who can open a shell inside a running container. You must list these subresources in your role rules to allow entry. Leaving the shell subresource out of default developer roles keeps running pods locked down.
How to scope pod rules for daily operations
Start by separating read rules from write rules in each namespace. Give most engineers a role that lets them view pod status and read logs. Hold back the subresource rule that lets users run interactive shell commands. Only grant shell entry when a team member needs to fix a live issue. This split stops casual mistakes in production namespaces.
You also need to control how pods run on the cluster nodes. Native namespace labels let you enforce baseline or restricted pod standards. These standards check pod specs before the cluster starts the containers. They block pods that ask for root host rights or unsafe volume mounts. Combining strict pod specs with tight role bindings covers both boot time and user entry.
K8s Pod Security Standards + EKS Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native pod rules solve and what keeps the session active
Native role bindings do a great job of deciding who can reach the cluster API. They block unauthorized users from listing pods or starting a shell session. Pod standards also stop containers from taking over the host node at startup. For static permissions, the built-in Kubernetes rules work well.
The gap appears after an authorized engineer opens a shell inside a pod. Native RBAC checks the request only when the session starts. Once the shell is open, Kubernetes does not check individual commands in flight. A user with shell rights can run any tool installed inside that container. They can query attached databases, read local files, or dump memory.
Pod logs and shell outputs can also expose sensitive user data on screen. When an engineer inspects a live app, raw emails, phone numbers, or card numbers may appear. Native cluster roles cannot rewrite matched fields in results during a session. Teams that need command checks or data masking must look beyond static cluster roles.
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 proxy, a sidecar for your Kubernetes API, inline on the API connection. On every kubectl or API call an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
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, or hold risky calls for approval. On the way back, hoop.dev data masking walks JSON responses by key and masks matched values in Secrets, ConfigMaps, and pod logs in memory. View the project on GitHub.
Frequently asked questions
Can I write a deny rule in Kubernetes RBAC to block pod shell entry?
No, Kubernetes RBAC rules are strictly additive and do not support deny rules. To block shell entry, you must omit the exec subresource from the user's assigned roles.
What is the difference between a RoleBinding and a ClusterRoleBinding for pods?
A RoleBinding applies pod permissions inside one specific namespace only. A ClusterRoleBinding grants those pod permissions across every namespace in the entire cluster.
Do Kubernetes role rules inspect commands run inside an open pod shell?
No, the API server only checks permissions when the user first requests the shell subresource. It does not inspect or block individual shell commands after the session begins.
Related guides
In this post