Skip to content

Cilium "Policy denied DROPPED": find and open default deny

Ciliumtested on Cilium v1.20.5

The first policy that selects a pod in one direction switches on default deny there. The client only sees dropped packets as a timeout – Hubble shows the real destination and the reason "Policy denied".

Symptom

k -n tag12 exec client -- nslookup -timeout=2 notes-api
k -n tag12 exec client -- curl -s -m3 10.96.0.1:443
;; connection timed out; no servers could be reached
command terminated with exit code 1
command terminated with exit code 28

On L3/L4 there is no error message, only silence: nslookup and curl run into the timeout.

Diagnosis

Look at the dropped flows in the namespace. Hubble doesn't show the ClusterIP but the backend – Cilium translates service addresses at the socket already.

hubble observe -P --port-forward-port 0 --verdict DROPPED --namespace tag12 --last 2
tag12/client:60376 (ID:15951) <> 172.16.0.126:6443 (kube-apiserver)
  policy-verdict:none EGRESS DENIED (TCP Flags: SYN)
tag12/client:60376 (ID:15951) <> 172.16.0.126:6443 (kube-apiserver)
  Policy denied DROPPED (TCP Flags: SYN)

Causes

DNSDefault deny without a DNS exception

A policy with an empty podSelector and both policyTypes but no rules blocks everything in the namespace – including DNS to CoreDNS.

LabelDNS exception with the wrong namespace label

It works by IP but not by name: the exception selects the namespace by the label name. Nobody sets that; only kubernetes.io/metadata.name is reliable.

hubble observe -P --port-forward-port 0 --from-pod tag21-r4/web --verdict DROPPED \
  --last 2
tag21-r4/web:32987 (ID:95867) <> kube-system/coredns-7cd4959b5-nkb2d:53 (ID:70078)
  Policy denied DROPPED (UDP)
k describe netpol allow-dns | grep -A2 'To:'
k get ns kube-system --show-labels
    To:
      NamespaceSelector: name=kube-system
      PodSelector: k8s-app=kube-dns
NAME          STATUS   AGE   LABELS
kube-system   Active   4h    kubernetes.io/metadata.name=kube-system

DirectionOnly one side opened

Egress at the client and ingress at the destination are closed separately. Enabled in the agent means: default deny applies in this direction.

k -n kube-system exec $CP -c cilium-agent -- cilium-dbg endpoint list \
  | grep -E 'ENDPOINT|app=client|app=notes-api'
ENDPOINT   POLICY (ingress)   POLICY (egress)   IDENTITY   LABELS ...         IPv4
388        Enabled            Enabled           15951      k8s:app=client     10.0.2.58
3952       Enabled            Enabled           64913      k8s:app=notes-api  10.0.2.198

Fix

Allow DNS to CoreDNS – UDP and TCP, because large answers come over TCP – and select the namespace by kubernetes.io/metadata.name. Then open each direction separately.
k apply -f allow-dns.yaml
k -n tag12 exec client -- nslookup notes-api.tag12.svc.cluster.local
hubble observe -P --port-forward-port 0 --namespace tag12 --to-port 53 --last 1
Name:	notes-api.tag12.svc.cluster.local
Address: 10.109.31.111
tag12/client:47319 (ID:15951) -> kube-system/coredns-559f6c778d-nz7t6:53 (ID:13185)
  policy-verdict:L3-L4 EGRESS ALLOWED (UDP)

Don't: Deleting the policy instead of fixing it. Default deny is intended – only the exception is wrong.

▶
Break it yourself and find it – free
Cilium hands-on, day 12: default deny, DNS exception, L3/L4, L7 and FQDN egress, proven with Hubble and cilium-dbg.
Go to day 12 →

FAQ

Why does Hubble show the API server's node IP instead of 10.96.0.1?

Cilium translates service addresses at the socket already. The policy then sees the backend.

Why do some blocks return a 403 instead of a timeout?

A 403 Access denied comes from Envoy for an L7 rule (L4 allowed, L7 not). A timeout means the packet was already dropped on L3/L4.

Related error patterns

More