All articles

What Should Still Work After a Default-Deny Policy?

A plan for rolling out default deny in a small Kind lab, one allow rule at a time.

Four-zone left-to-right diagram: a must-work list feeds Cilium default deny and one-at-a-time allow rules, dropped flows appear in Hubble, and tested rules end in a results table.
Look at the Cilium zone: the deny goes first, and its dropped flows in Hubble show what the list missed. Each allow rule then adds one line to the results table.

After I wrote about following one request with Hubble in A Pod Is Ready. Why Is the Request Timing Out?, one question stayed with me. If I apply a default-deny policy tomorrow, what will stop working that I forgot about?

Simply put, default deny means every connection is blocked unless a rule says it is allowed. It is a good idea for security. However, the first time you apply it, something usually breaks in a place you did not think about. It is like locking every door in an office on Friday evening. The building is safe, but on Monday the cleaner, the delivery driver and the fire inspector cannot get in.

This article is the plan I want to follow in the same disposable Kind lab. I have not run it yet, so the results table is empty on purpose. I will fill it in when I do.

What breaks first?

In a Cilium setup, a policy that selects a Pod and has an empty ingress or egress list acts as a deny for that direction. Hubble shows the blocked traffic as dropped flows with the reason POLICY_DENIED. The Hubble CLI documentation shows how to filter them with hubble observe --verdict DROPPED.

So, before applying anything, write a short list of what must still work. For a small lab app, my list is:

  1. DNS from the app Pod to kube-dns, because every other call starts with a name lookup.
  2. The app's own dependency, for example a backend in another namespace.
  3. Health checks, so Kubernetes does not restart a Pod that is actually fine. I am not sure these are blocked in every setup, which is why they are on the list to test.
  4. The path in from the Gateway or ingress, if the app is exposed.
  5. Hubble itself, so you can still see what is happening.

The order matters. The third-party troubleshooting write-ups I have read say the same thing: fix DNS first, then health checks, then the application rules. It makes sense to me. A broken DNS rule can make every other failure look like a different problem, so I would not trust any other result until DNS works.

How do I add the rules one at a time?

You should apply the deny first, on its own, and read the dropped flows before writing any allow rule. The drops give you a free list of what you missed.

After that, add one rule, then run two requests. One request should be allowed and one should be denied. Keep both lines of Hubble output as evidence. If you only test the allowed case, you cannot tell a good rule from a rule that allows everything.

When I run it, I plan to keep three terminals open. A client loops curl in the first one. The second runs hubble observe --verdict DROPPED. The third shows the policy file getting longer. The allowed client should start working first, and the denied client should keep failing.

There is a note to take here about how a denied client behaves. A dropped connection usually just hangs until the timeout, which feels like a slow network and can waste a lot of time. Cilium 1.19 is reported to add ICMP "destination unreachable" replies when a policy denies a connection, so the client can fail fast. I only have this from a news summary of the 1.19 release, so please confirm it in the official release notes, and check whether it is on by default, before you rely on it.

Here is the table I will fill in after the lab:

Step Allowed request Denied request Hubble verdict
Default deny only lab result needed lab result needed lab result needed
Allow DNS lab result needed lab result needed lab result needed
Allow backend call lab result needed lab result needed lab result needed
Allow health checks lab result needed lab result needed lab result needed
Allow Gateway path lab result needed lab result needed lab result needed

What about newer features and safer rollout?

Two more things are on my list, both to verify as of November 2026.

First, the Isovalent post on Cilium 1.20 describes support for Kubernetes ClusterNetworkPolicy with Admin and Baseline tiers. As I understand it, an admin tier lets a platform team set rules that application teams cannot override, and a baseline tier gives defaults that teams can change. The post also mentions that Hubble can link audit verdicts to the policies that would have applied. Some secondary sources say 1.20 rejects empty-spec policies at admission. If that is true, the "empty list" default deny above may need a different form, so I will read the upgrade notes before I trust my old YAML.

Second, audit mode. The CNCF has a good post on testing and simulating Cilium policies safely. I plan to use it in the lab, but you should not treat it as a guarantee for production. A lab only has the traffic you thought of, and a real system has the traffic you forgot.

One more thing to ask is who will read these drops at 2 a.m., and whether that person knows the command.

What can you try this week?

Take one test namespace, not a real one. Write down your own list of five things that must still work. Apply the deny, run hubble observe --verdict DROPPED, and compare what you see with your list. Whatever is on the screen and not on your list is what you would have missed.

Next, I want to leave networks for a while and ask a simpler question about data: Before I Build a Data Warehouse, What Does One Row Mean?