A firewall at the edge of a company network cannot stop every unwanted connection between systems already inside it. Internal firewalls and microsegmentation narrow which workloads can communicate, including across servers and Kubernetes clusters. Zero trust goes further by making access depend on the requesting subject, device and resource rather than treating an internal address as proof of trust.
When one compromised server can reach too much
Consider three systems in an enterprise: a public-facing frontend, a private application API and a financial database. The frontend legitimately needs to call the API. The API legitimately needs to query the database. The database should not accept direct connections from the frontend or a separate reporting service.
If all systems share a flat internal network with broad allow rules, compromising the frontend may offer a path toward the database, administrative ports or other hosts. The initial compromise and subsequent movement are different security problems. A stronger perimeter may reduce the initial intrusion risk, while microsegmentation can restrict the connections available after an attacker obtains access to one component.
A simple intended policy could be:
| Source | Destination | Connection | Expected outcome |
|---|---|---|---|
| Frontend | Application API | Approved service port | Permit |
| Application API | Database | Database service port | Permit |
| Frontend | Database | Direct database port | Deny |
| Reporting workload | Database | Direct database port | Deny unless explicitly required |
| Administrative workstation | Server management | Approved management path and identity | Permit through appropriate management controls |
This table says what communication should happen. It does not itself show where the decision is enforced, what source identity is trusted, whether a workload can change labels or IP addresses, or whether a compromised API already has rights to perform sensitive database operations. Those questions determine the design’s actual security value.
Accessible text alternative for this figure
Two panels compare reachability after the frontend is compromised. In the flat network the compromised frontend reaches both the API service and, directly, the database.
In the microsegmented network the frontend reaches only the API service, the API service reaches the database, and the direct path from the frontend to the database is denied.
The API route remains an allowed path, so application authorization is still required. The diagram is conceptual and is not evidence of a real intrusion.
Internal firewall and microsegmentation are related, not identical
An internal segmentation firewall controls selected communications between internal networks or security zones. It may be deployed at a data-center boundary, between VLANs, at a virtual network attachment, or as a firewall service inside a cloud or virtualization platform. Such a firewall can enforce policies at a shared transit point, provided that intended flows pass through it.
A host firewall acts on traffic to or from an individual operating system or endpoint. Windows Defender Firewall and Linux nftables are examples of mechanisms that can provide local inbound or outbound enforcement. These controls can restrict a host even where an upstream internal network permits the connection. They still require disciplined configuration, sufficient privileges and correct policy coverage, including IPv4 and IPv6 where used.
Microsegmentation is the practice of expressing narrow communication permissions between workloads, applications, services or resource groups instead of relying only on large network zones. Implementation may use host agents, hypervisor controls, cloud security groups, network fabric controls or Kubernetes network plugins. A technology’s existence does not prove the segmentation objective has been met.
| Enforcement position | Useful control | Operational consideration |
|---|---|---|
| VLAN or routed segment boundary | Networks and subnet pairs | Broad trust may remain within each network |
| Internal firewall appliance | Routed east-west traffic | Routing coverage and stateful return path |
| Hypervisor or distributed firewall | Traffic near virtual machines | Workload identity, management integration and host reachability |
| Operating-system host firewall | Per-host services, interfaces and directions | Endpoint administration and tampering resistance |
| Cloud security group | Supported network interfaces or workload resources | Association, effective policy and provider-specific behavior |
| Kubernetes CNI policy | Selected Pods and supported traffic directions | Requires plugin enforcement and correct selectors |
The central trade-off is precision against operational complexity. A policy written for a stable application identity can survive certain IP changes, but it depends on the integrity of the identity source and on an enforcement system that understands it. A policy based only on a static subnet can be simpler to operate but may allow unrelated workloads that share that subnet.
Follow a request through the actual enforcement points
Imagine a frontend Pod initiating an HTTPS connection to an API Pod. A network engineer should trace source identity, destination resolution, selected destination address and port, applicable egress policy, applicable ingress policy, and application authentication.
The source can be described by its Kubernetes namespace and labels, an OS process, a virtual machine identity or a cloud network interface, depending on the enforcement model. At a Kubernetes policy boundary, the CNI plugin evaluates traffic based on the effective policies associated with Pods and peers. At a traditional internal firewall, the enforcement device may primarily observe addresses, protocols, ports and whatever identity or content metadata its integration makes available.
Two independent decisions matter. First, does the network permit this connection? Second, does the receiving application accept the identity and action requested? A permitted TCP session is not approval to read every customer record. Even encrypted transport such as mutual TLS does not automatically establish the caller’s entitlement to a particular operation. It authenticates participating endpoints or services according to the configured trust model, while authorization still requires an appropriate policy decision.
Accessible text alternative for this figure
A flow runs from the source Pod, whose egress policy makes the source decision, to the destination, whose ingress policy makes the destination decision. If both allow, the network permits the connection to the destination API.
A separate application check then decides on the user, the action and the resource. If either isolated direction denies there is no new flow, and broad additive allows may reopen a path.
Network reachability and resource authorization are independent controls. Actual behavior depends on the network plugin.
For stateful controls, the response to an allowed new connection is ordinarily treated differently from a new connection originating in the opposite direction. An allow rule for A to start a session with B does not necessarily permit B to initiate an unrelated session back to A. This distinction is explicit in Cilium’s policy-enforcement reference.
Kubernetes NetworkPolicy: declaring intent is not enforcement
The Kubernetes NetworkPolicy resource defines how selected Pods may communicate with peers over supported protocols. The official Kubernetes documentation makes a crucial requirement explicit: creating a NetworkPolicy object has no effect unless the cluster uses a network plugin that implements NetworkPolicy enforcement.
Baseline NetworkPolicy describes rules mainly at Layers 3 and 4, using Pods, namespace selectors, CIDR ranges and ports. It does not provide universal HTTP-path authorization, DNS name matching or user-identity authorization. A provider-specific CNI may support extensions, but those must not be mistaken for baseline Kubernetes behavior.
Ingress and egress isolation are separate
Kubernetes evaluates whether a Pod is isolated for ingress and egress independently. By default, Pods are non-isolated in both directions. A NetworkPolicy that selects a Pod and declares ingress control can make it ingress-isolated, permitting only allowed incoming traffic. Egress isolation is controlled independently by egress policy selection.
For a connection between two Pods, if the source is egress-isolated, an applicable egress rule must allow the destination. If the destination is ingress-isolated, an applicable ingress rule must allow the source. Therefore, one side allowing traffic does not prove the connection works when the other direction has an independent restriction.
Kubernetes policies are additive allows. If multiple NetworkPolicies select a Pod in the same direction, the allowed flows are the union of their rules. There is no standard NetworkPolicy rule order that turns a narrower policy into an overriding deny. One accidentally broad allow can reopen traffic that another policy author intended to restrict.
A default-deny policy for ingress and egress can be written using the documented networking.k8s.io/v1 API:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny
namespace: application
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress
This example selects all Pods in the application namespace and supplies no allowed ingress or egress peers. Its intended result depends on an enforcing CNI. It should not be deployed blindly to a working production namespace because it can interrupt DNS, service discovery, readiness-related dependencies, telemetry, external calls and application connectivity.
How selectors change the scope
A podSelector identifies destination Pods for the policy within its namespace. Individual ingress or egress peers can then use podSelector, namespaceSelector, ipBlock and permitted combinations. Indentation and peer structure are meaningful.
For example, a single peer entry containing both namespaceSelector and podSelector selects Pods matching the Pod labels within namespaces matching the namespace labels. Two separate peer entries instead express a union, one matching the namespace selector and the other matching the Pod selector in its own applicable scope. The Kubernetes NetworkPolicy guide documents this distinction with examples.
Labels are not an immutable security principal. Anyone authorized to change Pod or namespace labels may affect which policies select a workload. Kubernetes RBAC, admission controls and cluster governance therefore matter. A network identity built from an unprotected label cannot establish a trustworthy isolation boundary by itself.
A concrete frontend, API and database policy
Suppose the namespace contains Pods labeled role: frontend, role: api and role: database. A useful security goal is to permit API Pods to reach a database on its approved service port while preventing direct database access from frontend Pods. A destination ingress policy can express that condition:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: database-ingress
namespace: application
spec:
podSelector:
matchLabels:
role: database
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
role: api
ports:
- protocol: TCP
port: 5432
This is an illustrative PostgreSQL port policy rather than a recommendation for an untested cluster. Its allowed peers are API-labeled Pods in the same namespace. A separate broader policy selecting the database could permit additional sources. If API Pods are also egress-isolated, their policies must permit the database destination. Connection and service behavior can also depend on the CNI’s network translation and service implementations.
To make the architecture genuinely least-privilege, engineers should inventory actual service dependencies, constrain both directions as needed and test whether normal workloads still function. A Kubernetes Service object is not an authorization boundary. NetworkPolicy commonly selects Pods rather than treating the Service name as an identity that grants access.
A worked example: why a second policy can reopen the database
Suppose the database ingress policy above is in force and permits only Pods labeled role: api on TCP 5432. A different administrator adds the following policy in the same namespace:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: broad-database-access
namespace: application
spec:
podSelector:
matchLabels:
role: database
policyTypes:
- Ingress
ingress:
- from:
- podSelector: {}
ports:
- protocol: TCP
port: 5432
The empty peer podSelector: {} matches all Pods in the local namespace. Because baseline NetworkPolicy combines the allowed flows from every policy selecting a given Pod, this new rule permits frontend and unrelated Pods in that namespace to initiate database connections on TCP 5432, subject to any independent egress isolation at the source. The earlier database-ingress rule does not override this broader permission. Neither rule has priority in the baseline API.
This example is an intentional illustration of a policy mistake, not a recommended configuration. It shows why reviewing a single well-written NetworkPolicy resource is insufficient. An effective audit must evaluate the union of all applicable ingress rules and, separately, the egress rules selecting the connecting source.
A compact decision table illustrates this model. Assume the destination database is ingress-isolated and the source’s relevant egress state is known:
| Source egress permits TCP 5432 | Database ingress permits source | New connection permitted by baseline policy? |
|---|---|---|
| Yes | Yes | Yes, subject to other networking and application conditions |
| Yes | No | No |
| No | Yes | No |
| No | No | No |
For a source that is not egress-isolated, its egress side permits the connection by default. For a destination that is not ingress-isolated, its ingress side permits it by default. The policy decision is evaluated per direction. A successful network connection does not establish that PostgreSQL authentication or database grants permit the requested operation.
The dependencies default deny can break
A deny-by-default cluster design is defensible only when the necessary allow rules have been identified. DNS is an immediate example. If an application Pod must resolve api.internal through cluster DNS, an egress deny can block its request to the DNS service even though the application has an ingress allow rule for its eventual API connection.
DNS typically uses UDP 53 and sometimes TCP 53, but real resolution paths vary by cluster. A policy that allows access to one DNS Pod label or namespace may not match a deployment using a different cluster DNS or NodeLocal DNSCache path. Hardcoding one example is not universal advice.
Other dependencies include metrics collectors, health and readiness interactions, admission webhooks, time synchronization, certificate management, external identity services and storage endpoints. Some probes originate from cluster nodes and may not follow ordinary Pod-to-Pod filtering semantics. Their precise handling requires the selected Kubernetes version and CNI documentation.
The Kubernetes NetworkPolicy reference notes that baseline TCP and UDP controls are defined, SCTP support depends on the CNI, and behavior for other protocols such as ICMP or ARP can vary. This is a reason to validate desired outcomes on the real data plane, not to assume a rule named deny-all blocks every possible packet type.
Existing connections and node-local traffic have special limits
There is a material distinction between denying new connections and immediately terminating existing sessions. Kubernetes documents that when NetworkPolicy rules or matching labels change during an established connection, whether the change disrupts that connection is implementation-defined. A restrictive policy may prevent a new connection while an existing flow continues under the selected plugin’s connection-tracking behavior. This matters during incident containment. An emergency isolation plan should not assume policy edits instantly terminate every established session. See the Kubernetes NetworkPolicy limitations.
Kubernetes also states that ordinary Pods cannot use baseline NetworkPolicy to block all traffic from their resident node. hostNetwork policy matching has implementation-defined behavior and is often treated as node traffic. A Pod policy is therefore not a substitute for securing node services, kubelet access, container privileges, host endpoints or sensitive metadata services.
The distinction is particularly important if an attacker compromises a workload with elevated Linux capabilities, host network access or permissions to create privileged Pods. At that point, the relevant security boundaries include Kubernetes authorization, runtime isolation, node defenses and host-specific network policy, not only the namespace’s NetworkPolicy.
Cilium extends the policy model, but the extension is not universal
Cilium implements Kubernetes networking and policy with an eBPF-based data plane and identity-aware policy mechanisms. It supports standard NetworkPolicy as well as custom resources such as CiliumNetworkPolicy and CiliumClusterwideNetworkPolicy. Its custom policy resources can express Layer 7 rules, including supported HTTP and DNS constraints, that baseline Kubernetes NetworkPolicy does not provide.
Cilium’s policy-enforcement modes distinguish default, always and never. In default mode, endpoints normally have unrestricted traffic until an applicable policy selects them for a direction, then only the allowed traffic in that direction passes. Always mode enables enforcement for all endpoints. Never mode disables policy enforcement even when policy objects exist.
These controls are not equivalent to a standard Kubernetes NetworkPolicy field called mode. They configure Cilium’s implementation, and a cluster may also apply cluster-wide or administrative policy constructs that alter evaluation. An engineer should first establish which CNI and version run in the cluster.
Cilium currently documents Kubernetes ClusterNetworkPolicy support behind an explicit feature flag and additional CRD installation. Its priority tiers distinguish administrator rules, workload policies and baseline safeguards. Those constraints must be checked before promising a cross-namespace or tiered deny policy. Such behavior is not implied by networking.k8s.io/v1 alone.
Cilium’s data plane, identity and Layer 7 proxy path
The high-level Cilium enforcement pipeline is: Kubernetes labels and supported endpoint metadata contribute to a security identity, policy is compiled into effective endpoint rules, and eBPF programs on relevant node networking paths enforce supported Layer 3 and Layer 4 decisions. For cross-node traffic, Cilium documents propagating identity so a receiving node can evaluate the originating endpoint. This is a mechanism for network-policy enforcement, not a cryptographic human identity or proof of an authenticated application user. See the Cilium policy-enforcement documentation.
When an applicable CiliumNetworkPolicy includes supported HTTP or DNS Layer 7 rules, Cilium can redirect traffic to a node-local Envoy proxy for application-protocol enforcement. Cilium’s Layer 7 reference explains that a denied HTTP request can receive a protocol-level HTTP 403 response, while a denied DNS request can receive DNS REFUSED. That is different from a Layer 3 or Layer 4 deny, which commonly causes packets to be dropped and may appear as a timeout.
This proxy introduces availability and capacity considerations. Cilium documents Envoy as either an independently deployed DaemonSet or a component embedded with the Cilium agent. In the embedded arrangement, traffic requiring Layer 7 proxy enforcement depends on agent availability. The proxy is also only relevant for traffic that matches the configured Layer 7 policy and supported protocol.
One subtle policy interaction is critical: a broad Layer 4 allow covering the same endpoint and port can make a narrower Layer 7 rule ineffective. The Cilium Layer 7 documentation explicitly warns that, when a comparable Layer 4-only rule and an L7 rule both allow the same traffic class, the L7 restriction can have no effect. The correct evaluation is the complete effective policy, not simply the presence of an HTTP path condition in one CRD. Cilium’s custom deny or tiered policies have additional semantics, but they do not turn baseline Kubernetes NetworkPolicy into an ordered deny-rule system.
DNS-name policy depends on a trusted resolution path
Cilium’s toFQDNs feature is sometimes described as a convenient hostname-based egress allowlist. The technical mechanism is more specific. A Cilium DNS proxy observes supported DNS responses, learns their returned IP addresses and uses those addresses to construct the relevant allowed destination entries. The policy therefore depends on DNS query interception, DNS response caching and the trustworthiness of the resolver providing the answers.
The Cilium Layer 7 DNS documentation warns that an untrusted resolver can influence the addresses learned for toFQDNs. Operators should constrain DNS interception to the intended trusted cluster resolver and confirm the actual query path, including any node-local DNS cache. The learned IP mapping is not equivalent to inspecting the hostname of every subsequent encrypted connection. An allowed IP may host additional services, and changes in DNS answers can affect policy over time.
This is a boundary between service-name intent and packet-address enforcement. A team should not claim that a toFQDNs rule continuously validates the destination application’s hostname or identity during every TCP session.
L7 filtering and identity do not eliminate application security
An extended Cilium rule may permit traffic only to particular HTTP methods or paths, if the appropriate proxy and protocol integration support that traffic. This can prevent certain unwanted service calls at a network enforcement point. It does not necessarily authenticate the ultimate human user or determine whether a request to /accounts/842 is authorized for that user.
Cilium maps labels to security identities for supported policy enforcement. This helps policies follow workloads as their addresses change. The security boundary still depends on the integrity of labels, cluster privileges and identity distribution. A compromised component that can modify its own trusted classification may undermine the intended restriction.
Cilium also provides observability through Hubble, which can expose supported flow and policy context. Those records are useful for checking actual traffic, but they are not universal packet captures or proof of application authorization. Logging configuration and coverage must be understood.
Host networks, address translation and cross-cluster paths
A Kubernetes workload is not always a Pod with ordinary overlay addressing. hostNetwork Pods, node services, kubelet-originated probes, load balancers and ingress gateways can have different traffic paths and filtering treatment. Whether a baseline NetworkPolicy applies to traffic entering through a host namespace or node interface depends on the plugin and deployment.
Address translation also matters. A Pod may connect to a Service address that is translated to an endpoint address. Kubernetes documentation notes that behavior with ipBlock and addresses rewritten by Service or load-balancer implementations can depend on where packet processing and policy enforcement occur. A rule matching a destination CIDR may therefore need specific validation.
Cross-cluster communication adds another boundary. Workload identities, trust roots and policy scopes may not survive a connection across a gateway, VPN or service mesh in the same form. A service mesh can add mutual TLS and request-level authorization for selected supported services, but a sidecar or gateway does not automatically secure traffic outside its interception scope.
These are not reasons to abandon microsegmentation. They are reasons to avoid inferring enforcement from a namespace label or architecture diagram alone.
Zero trust is a resource-access architecture, not a firewall setting
NIST SP 800-207 describes zero trust as an approach that removes implicit trust based solely on physical or network location. The protected objects are enterprise resources. Subjects and devices must be authenticated and authorized before a session to a resource is established, according to the organization’s policy and context.
NIST’s architecture distinguishes a policy engine, which makes access decisions, a policy administrator, which establishes or ends supported communication paths following a decision, and policy enforcement points, which enable, monitor or terminate access to resources. Identity systems, device security posture, policy information points and telemetry contribute to those decisions.
Network segmentation is a useful component of this architecture because it reduces where an authenticated or compromised workload can connect. But default-deny TCP rules alone are not complete zero trust. A network policy may allow API Pods to reach a service while still being unable to determine whether the caller’s business role permits a specific transaction.
| Security question | Network segmentation | Identity-aware resource authorization |
|---|---|---|
| Can this workload reach the database port? | Can deny or permit the connection at supported enforcement points | May also consider service identity or authorization policy |
| Is this API caller authenticated? | Cannot inherently establish the caller’s complete identity | Checks an appropriate identity token, certificate or session |
| May the caller view another tenant’s document? | Cannot infer ownership from an allowed TCP flow | Application or resource policy must decide |
| Is the device compliant with endpoint policy? | Usually not observable from the packet alone | Can use relevant posture signals when integrated |
| Should access continue after risk changes? | Can update or revoke network paths where supported | Decisions and enforcement can respond to updated session or risk context |
Zero trust also requires attention to the trustworthiness of the decision signals. A token that is not validated, a certificate with uncontrolled issuance or a workload identity derived from arbitrary mutable labels does not become secure merely because a policy engine uses it.
An end-to-end zero-trust decision
Consider an engineer using a managed device to access an internal operational dashboard. An identity provider authenticates the engineer, a device-management system reports a posture signal, and a policy engine decides whether the subject may access that dashboard under the current context. A policy administrator then uses a supported enforcement mechanism to establish the permitted access path. The dashboard still checks whether that engineer may view or change the specific operational resource.
The decision involves at least three independently verifiable layers:
| Stage | Evidence needed | Failure that a network allow rule cannot correct |
|---|---|---|
| Authenticate subject and device | Trusted session, credential validation and relevant posture evidence | Stolen or improperly validated identity |
| Authorize resource access | Role, attributes, resource ownership, action and applicable conditions | Authenticated subject performs an unauthorized operation |
| Enforce and monitor the connection | PEP decision, active session, policy changes and relevant events | Bypassed enforcement point or unchanged access after risk rises |
This decomposition reflects NIST SP 800-207, not a claim that every product implements identical continuous risk scoring. A Kubernetes NetworkPolicy can help constrain the dashboard’s network reachability, but it is not, by itself, the NIST policy engine that evaluates human and device authorization.
What internal segmentation can mitigate
The most defensible benefit of microsegmentation is that it reduces the set of network relationships reachable from a particular workload. This can limit opportunities for lateral movement after an initial compromise, but the degree of protection depends on actual policy granularity and attacker privileges.
| Threat or failure | How segmentation helps | Remaining exposure |
|---|---|---|
| Lateral movement from compromised frontend | Deny direct frontend-to-database and management connections | Allowed frontend-to-API path remains accessible |
| East-west network reconnaissance | Reduce which internal service ports answer requests | Application metadata, DNS and allowed services can still reveal information |
| Ransomware propagation | Limit unnecessary file-sharing and administrative paths | Compromised identities, allowed file services and endpoint execution remain threats |
| Credential theft | Restrict some destinations where stolen credentials could be used | Existing trusted paths and valid application permissions can still be abused |
| Compromised build or service Pod | Limit network access to unrelated namespaces and stores | Excessive Kubernetes RBAC, secrets or node privileges can enable alternate paths |
| Unauthorized database query | Block unapproved direct database connections | A compromised authorized API may still query the database using legitimate credentials |
The table does not claim a measured reduction in attacks or universal prevention. It explains plausible control effects, grounded in the enforcement positions. Segmentation can also create outages when overly narrow policy blocks required services, especially where DNS, observability, storage and health checks have not been mapped.
Measure the containment boundary, not just the block count
For the illustrative compromised frontend, consider four post-compromise routes: direct database access, server-management ports, the permitted frontend-to-API channel, and access to cluster credentials or host networking. A correctly enforced microsegmentation rule may close the first two network paths while leaving the API channel open for legitimate business traffic. It cannot independently revoke credentials already held by the frontend or prevent misuse of an allowed API method.
This distinction avoids overstating blast-radius reduction. Define the protected resources, enumerate expected network edges, and show which edges policy removes. Then identify the still-permitted edges and the non-network trust mechanisms that govern them. No risk-reduction percentage is justified without a defined threat model and empirical evidence.
How to verify the effective boundary
The engineering result should be tested communication constraints, not just policy files committed to Git. A sensible validation begins by inventorying actual traffic among services, then stating which source-destination relationships should remain and which should fail.
For Kubernetes, verify the CNI implementation, supported policy resource kinds, policy-enforcement mode and the deployed selectors. Confirm whether the test Pod matches the correct namespace and labels. Inspect all policies that select that Pod because baseline policy permits the union of matching allowed flows.
Then test at least two controlled scenarios: a frontend connecting to its approved API should succeed, while a frontend initiating a direct database connection should fail under the relevant policy. Separately confirm that the API can connect to its database and resolve the names it needs. For a stricter policy, also test required health and monitoring dependencies. Run these checks from the intended source workloads, not merely from an administrator’s workstation.
A minimal verification procedure with real observability boundaries
Start with read-only discovery. A cluster operator can use commands such as:
kubectl get networkpolicy -A
kubectl -n application describe networkpolicy database-ingress
kubectl -n application get pods --show-labels
These commands show declared objects and current labels, not whether packets were denied. For a cluster using Cilium and with appropriate diagnostic tooling available, Cilium’s troubleshooting documentation describes the importance of the agent’s effective policy-enforcement mode. Hubble can provide flow-level verdicts when enabled, such as:
hubble observe --verdict DROPPED
A drop verdict is useful, but it still needs the correct workload, time, direction and policy context. An empty result does not prove that every flow was permitted, because telemetry scope, retention, sampling, forwarding or availability may limit observation. A successful TCP connect test establishes reachability, not business authorization.
A stronger check creates an explicit test matrix: source frontend Pod to API Pod (permit), source frontend Pod to database Pod (deny), API Pod to database Pod (permit), and API Pod to DNS resolver (permit). Test from the designated source Pods using safe, authorized connectivity checks. Record the source Pod and labels, target address and port, effective policies, CNI version, observed flow event and application response. If an existing session was created before a policy change, test a fresh connection separately.
A production verification record can include:
- The expected communication matrix with source, destination, protocol, port and responsible application.
- The effective enforcement point, including whether the CNI or host firewall actually supports the configured rule.
- The policy object, selected workload labels, namespace, enforcement mode and other matching policies.
- Positive tests for approved paths and negative tests for intentionally forbidden paths.
- Flow logs or telemetry, route and translation context, plus the application result.
- A rollback mechanism and a defined response when essential communication unexpectedly fails.
Where service meshes or identity-aware gateways are deployed, add checks of authentication, certificate identity and application authorization. A connection success or failure alone is not a substitute for validating those independent decisions.
Designing the boundary around the workload
Internal firewalling becomes more useful when policy follows the application relationship rather than a large address block. Start with the few services that hold sensitive data or offer administrative access. Identify their legitimate callers, enforce the narrowest practical paths and verify that the traffic follows those rules.
For Kubernetes, distinguish basic NetworkPolicy from the extended behavior of the installed CNI. For identity-aware zero-trust access, require decisions based on the caller, device and resource rather than assuming a private network is trusted. Use host protection, service authorization and credential management as complementary controls.
A well-segmented network restricts which workloads can talk. A zero-trust architecture also decides which authenticated subjects may use each protected resource. Neither claim is credible without evidence that the intended enforcement actually occurred.
References and further reading
- Kubernetes: Network Policies
- Kubernetes: NetworkPolicy API reference
- Cilium: Kubernetes Network Policy and extended CRDs
- Cilium: Policy enforcement modes
- Cilium: Policy enforcement and connection direction
- Cilium: Architecture and Hubble observability
- Cilium: Layer 7 enforcement, Envoy and DNS policy
- Cilium: Threat model and trusted DNS boundary
- Cilium: Hubble observability filters
- NIST: Zero Trust Architecture SP 800-207
- NSA/CISA: Kubernetes Hardening Guidance, v1.2 (2022)
