Secure East West Traffic in Kubernetes

Published
Length
3 min read

Luis Felipe Dias

All posts

To secure east west traffic in kubernetes, teams set strict pod network rules and narrow role permissions. These boundaries block unwanted pod calls and limit what workloads or users can reach inside the cluster. Most teams start with flat cluster networks where every pod can talk to every other pod. When roles or network paths stay too broad, one bad pod or user session can move across namespaces. How to secure east west traffic in kubernetes with native controls Inside a cluster, east-west

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 secure east west traffic in kubernetes, teams set strict pod network rules and narrow role permissions. These boundaries block unwanted pod calls and limit what workloads or users can reach inside the cluster. Most teams start with flat cluster networks where every pod can talk to every other pod. When roles or network paths stay too broad, one bad pod or user session can move across namespaces.

How to secure east west traffic in kubernetes with native controls

Inside a cluster, east-west traffic includes pod-to-pod calls and API requests that move across namespaces. Teams restrict pod paths by adding network rules that drop traffic unless a rule allows it. That stops a front-end app from calling a back-end store in another namespace without a rule. At the same time, admins must lock down the cluster API server itself.

In Kubernetes, a Role or ClusterRole holds rules that define a set of permissions. These permissions are only additive, which means there are no deny rules in the system. A Role always sets permissions within one single namespace. A ClusterRole is not namespaced and can cover cluster-wide resources like nodes or resources across all namespaces.

To attach these rules to users or workloads, admins create bindings. A RoleBinding grants permissions inside one specific namespace and can reference a Role or a ClusterRole. A ClusterRoleBinding grants access across the entire cluster. When a pod or engineer makes an API request, the API server checks these bindings first.

Why cluster roles and network rules leave a gap in flight

Network policies and role bindings solve the first part of internal cluster security. They decide which pods can open a socket and which users can call a cluster resource. Some APIs also use subresources, such as reading pod logs or running commands inside a pod. In RBAC, the subresource name uses a slash after the main resource name.

Once a binding allows a pod exec subresource or a database port, native controls step back. The cluster checks who opens the channel, not what individual commands or queries run inside it. An engineer or service with pod exec permissions can run any shell command inside that container. A workload or user that reaches an internal store can query raw tables with emails or card numbers.

Also, because RBAC rules are only additive, broad ClusterRoleBindings often stack up over time. Teams cannot write a quick deny rule to block one risky action inside an allowed namespace. They must trace every binding by hand to see why a subject still has wide reach.

East-West Traffic Security + Just-in-Time Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Keeping internal cluster sessions and subresources tight

To keep internal movement safe, teams should avoid cluster-wide bindings for daily work. Granting a RoleBinding in one namespace keeps a service account or user inside that boundary. If a team needs to read pod logs, grant only the log subresource instead of full pod rights. Separate the permissions for reading pod status from the permissions for running interactive pod commands.

Teams should also audit which service accounts mount tokens inside pods by default. If a pod does not call the cluster API, it should not hold active API permissions. Pairing tight namespace roles with strict pod network rules reduces lateral paths across the cluster. For interactive sessions and data queries, teams need controls that inspect actions and mask fields in flight.

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

What is the difference between a RoleBinding and a ClusterRoleBinding?

A RoleBinding grants permissions inside one namespace, while a ClusterRoleBinding grants permissions across all namespaces and cluster resources.

Can I write a deny rule in Kubernetes RBAC to block east-west API calls?

No, Kubernetes RBAC permissions are only additive and do not support deny rules, so you must remove broad bindings.

How does Kubernetes RBAC handle actions like reading logs or running pod commands?

RBAC treats pod logs and pod exec calls as subresources written with a slash after the pod resource name.

Short role checks help teams work fast. Simple rules make each review clear. Good logs keep every team safe. Scoped keys stop bad changes early.

The query runs. The emails stay hidden.