How to Configure EKS Exec Into Pod
You set up eks exec into pod permissions by mapping cloud identities to Kubernetes RBAC roles. These roles must grant access to the pod resource and the exec subresource. Many teams start by giving developers broad cluster admin rights to fix broken apps fast. Overly broad roles let users run any command in any container across the whole cluster. A small mistake in one container can then break live workloads or expose private data. How native eks exec into pod permissions work Amazon EKS reli
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 exec into pod permissions by mapping cloud identities to Kubernetes RBAC roles. These roles must grant access to the pod resource and the exec subresource. Many teams start by giving developers broad cluster admin rights to fix broken apps fast. Overly broad roles let users run any command in any container across the whole cluster. A small mistake in one container can then break live workloads or expose private data.
How native eks exec into pod permissions work
Amazon EKS relies on two separate checks before a user can open a container shell. First, the user proves their identity to the cloud provider and the cluster API server. Second, Kubernetes RBAC checks if that identity has a rule that allows the action.
In Kubernetes RBAC, a Role or ClusterRole holds a list of rules for resources. All rules in this system are additive, and there are no deny rules at all. A standard Role always sets rules inside one single namespace. A ClusterRole is not tied to one namespace and can cover the whole cluster.
To let someone open a shell, the role must include the pod exec subresource. Kubernetes RBAC writes subresources with a slash, just like the API URL path. The role needs rules for both reading pods and using the pods exec subresource. You can also limit the rule to specific pod names using the resource names field.
After you create the role, you link it to a user with a binding. A RoleBinding grants those permissions inside one specific namespace. It can point to a Role in that namespace or a shared ClusterRole. A ClusterRoleBinding grants the permissions across every namespace in the entire cluster. For day-to-day app work, teams should use a RoleBinding in a single namespace.
What native RBAC solves and what it leaves open
Native RBAC is great at controlling who can start a shell session in a namespace. You can lock down prod namespaces so only on-call engineers can open a pod shell. You can also block users from touching system namespaces or reading cluster secrets directly. This setup stops unauthorized users at the front door before a session even starts.
Still, Kubernetes RBAC only checks the request when the user first opens the shell connection. Once the shell session starts, RBAC does not inspect the commands run inside the container. Every command runs as the Linux user set in the container image, which is often root. An engineer with exec rights can read local files, dump memory, or view app keys.
K8s Pod Security Standards + EKS Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Native cluster audit logs also struggle to show what happens inside an open shell. The API server logs the initial request to open the exec subresource and the pod name. It does not log the full stream of commands typed or the output returned. If someone runs a script that prints customer emails or card numbers, the logs miss it.
Why teams need command-level controls for container shells
Because native roles stop at the door, platform teams face a tough choice in prod. If they block pod exec completely, engineers cannot debug hard issues when an app fails. If they allow pod exec via RBAC, they give up control over what happens inside. Standing RBAC bindings also stay active all the time, even when no outage is happening.
A safer setup separates the ability to connect from the actions allowed inside the session. Teams want to approve shell requests for a short time window during an active incident. They also need a full log of every command typed and every line of output. When output contains sensitive fields like phone numbers or national IDs, masking should rewrite those fields in results.
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 block specific shell commands using Kubernetes RBAC alone?
No, Kubernetes RBAC only checks if a user can call the pod exec subresource. It cannot read or filter the Linux commands a user types inside the open shell.
Should I use a RoleBinding or a ClusterRoleBinding for pod exec?
Use a RoleBinding whenever possible so the user can only access pods in one namespace. A ClusterRoleBinding gives exec access across every namespace, including critical system pods.
Does Kubernetes RBAC support deny rules to block sensitive pods?
No, Kubernetes RBAC permissions are purely additive and never include deny rules. You must build roles from zero and only grant access to the exact namespaces needed.
Related guides
In this post