How to Configure EKS Network Policy

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an eks network policy by writing rules for pod traffic. A network plugin on the cluster then reads and applies those rules. Teams often pair these traffic rules with broad cluster roles for their engineers. When roles are too broad, users can bypass network paths during live debugging. They can run direct commands inside pods without touching the normal network flow. How an eks network policy works in your cluster In a standard cluster, every pod can talk to every other pod. This o

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 an eks network policy by writing rules for pod traffic. A network plugin on the cluster then reads and applies those rules. Teams often pair these traffic rules with broad cluster roles for their engineers. When roles are too broad, users can bypass network paths during live debugging. They can run direct commands inside pods without touching the normal network flow.

How an eks network policy works in your cluster

In a standard cluster, every pod can talk to every other pod. This open setup makes early tests fast, but it creates risk in production. If an attacker gets into one pod, they can reach others nearby. An eks network policy stops this open flow of data between pods.

You write rules that pick pods based on their labels and namespaces. These rules say which pods or IP blocks can send data in. They also say where a pod can send data out on the network. By itself, the Kubernetes API only stores the policy object you create. You must run a network plugin on your nodes to read these objects. The plugin turns your label rules into local firewall rules on each node.

Teams usually start with a default deny rule for each namespace. This rule blocks all traffic that is not allowed by another rule. Next, engineers add small rules for each app tier in the cluster. For example, the web pod can talk to the API pod on one port. The API pod can then talk to the data store on another port. All other pod traffic stays blocked by the node plugin.

Managing roles alongside pod traffic rules

Network rules control how apps talk, while role rules control who changes them. In Kubernetes, a Role sets permissions inside one single namespace. A ClusterRole sets permissions across the whole cluster and its nodes. Both use additive rules, which means there are no deny rules in RBAC. You bind these roles to users with a RoleBinding or a ClusterRoleBinding.

Admins must restrict who can edit network rules in a shared cluster. If a user can write policy objects, they can open any network path. Even with tight policy edit rights, another big gap remains in daily work. Engineers often need to check logs or run commands inside running pods. Kubernetes treats pod logs and pod exec as subresources under the pod API. When you grant a role the right to exec, it applies broadly.

EKS Access Management + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native network and role rules leave open

An eks network policy only checks packets moving between pods or outside IPs. It does not check commands sent through the Kubernetes API server itself. When an engineer runs a shell session inside a pod, traffic goes elsewhere. The user talks to the API server, which talks to the node agent. This path bypasses the pod network rules you set up for apps.

Native role bindings also stop once the API server approves the first request. RBAC checks if a user can start an exec session or read logs. It does not check the individual commands typed inside that open shell. It also cannot mask sensitive fields like emails, phone numbers, or card numbers. If a log prints national IDs, the raw text goes straight to the screen. Teams need a way to govern live commands and rewrite matched fields in results.

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

Does a new EKS cluster block pod traffic by default?

No, all pods in a new cluster can talk to each other freely. Traffic keeps the session active until you add a network policy that selects those pods. Once a policy selects a pod, unlisted traffic is blocked.

Do network policies stop engineers from running commands in pods?

No, network policies only filter network packets between pods and IP addresses. Shell sessions from engineers go through the cluster API server and node agent. You must manage those sessions through role rules and runtime controls.

Can Kubernetes RBAC block a single command inside a pod shell?

No, RBAC rules are purely additive and only check the API request type. Once RBAC allows a user to open a pod shell, its job ends. It cannot read or block the shell commands that run inside the container.

The query runs. The emails stay hidden.