Many teams assume that if a Kubernetes pod runs a sidecar that launches another pod, the permissions of the sidecar automatically limit the child pod. The reality is that the child pod inherits the service account of the node or the upstream pod, and the original least privilege intent is lost. The misconception often leads teams to think they have achieved least privilege, but nested agents break that guarantee.
Why the assumption breaks down
In Kubernetes, a service account is attached to a pod, not to the process inside the pod. When a sidecar container starts a new pod – often called a nested agent – the API server creates the child pod with the service account that the node’s kubelet is allowed to use. If the node’s default service account has broad permissions, the nested agent can act on resources that the original pod was never meant to touch. The setup stage – creating service accounts, binding roles, and configuring OIDC tokens – tells the system who is making the request, but it does not stop the request from reaching the API server with excessive rights.
What true least privilege requires
To enforce least privilege, the enforcement point must sit where the request actually travels. The Kubernetes API server is the only place that can verify whether a call complies with a fine‑grained policy. If the request bypasses that gate, the policy is ineffective. Therefore, a control layer that intercepts every API call, evaluates the caller’s identity, and applies masking, approval, or blocking is essential.
The role of a Layer 7 gateway
A Layer 7 gateway operates at the protocol level, between the client (human, service account, or AI agent) and the Kubernetes API server. By positioning itself in the data path, the gateway can inspect each request, enforce policies, and produce audit records. This is where the enforcement outcomes – session recording, inline masking of secrets in responses, just‑in‑time approval for risky operations, and command blocking – are realized.
How hoop.dev delivers least‑privilege enforcement for nested agents
hoop.dev sits in the data path for every Kubernetes connection, including exec, port‑forward, and API calls made by nested agents. Because hoop.dev is the only component that sees the traffic before it reaches the API server, it can enforce the following outcomes:
