Skip to content

Policy Enforcement Modes: CCA practice questions

Whether a packet is checked against policy at all depends on the agent's enforcement mode, set with the Helm value policyEnforcementMode or the agent flag enable-policy. There are three values.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Policy Enforcement Modes covers in CCA

Whether a packet is checked against policy at all depends on the agent's enforcement mode, set with the Helm value policyEnforcementMode or the agent flag enable-policy. There are three values.

The default mode leaves an endpoint unrestricted until a policy selects it. Selection then switches the endpoint into default deny, but only per direction: a selecting rule with an ingress section restricts ingress, and one with an egress section restricts egress. A pod covered by an ingress-only policy can still send traffic anywhere. The first policy you write for a workload therefore changes its behaviour for that direction from allow-all to allow-listed, which is why adding a narrow rule sometimes breaks unrelated traffic.

The always mode enforces policy on every endpoint, even if no rule selects it, so a pod with no matching allow can send and receive nothing. This includes the health endpoint that every node runs for connectivity checks; the docs recommend adding a cluster-wide policy that lets reserved:health talk to remote-node when you use always.

The never mode turns enforcement off for all endpoints, even those that rules select. Policies stay in the API but have no effect, and all traffic is allowed in both directions.

Individual policies can opt out of triggering default deny. Setting enableDefaultDeny to false for ingress or egress means the rule is ignored when Cilium decides the endpoint's default state. The documented use case is a cluster-wide policy that routes all DNS through the DNS proxy for visibility without blocking anything. There is one limit: the flag does not cover L7 rules. An HTTP rule that does not contain an L7 allow-all still rejects non-matching requests on that port.

Inside an enforced direction there is a second, smaller default. If an endpoint has no L4 policy, all ports are open; once at least one L4 rule applies, only listed ports pass, and ICMP is blocked unless it is related to an allowed connection.

What a denied client experiences is configurable too. Denied packets are dropped silently by default, so applications see timeouts. The experimental option --policy-deny-response=icmp sends ICMP Destination Unreachable back for denied egress traffic, provided the pod's ingress policy lets that ICMP in.

Key points

  • The mode is agent-wide: Helm policyEnforcementMode or the agent flag enable-policy.
  • In default mode an ingress-only policy leaves egress of the selected pod unrestricted.
  • always mode blocks unselected pods, health endpoints included, until something allows them.
  • enableDefaultDeny: false stops a rule from triggering default deny, but not for L7 rules.

Three sample questions

9 CCA questions on Policy Enforcement Modes, 9 with explanations. How practice works

Question 1

The Cilium agent runs with policyEnforcementMode: always. What happens to traffic of a pod that no CiliumNetworkPolicy or NetworkPolicy selects?
  1. A.All traffic to and from the pod is allowed
  2. B.All traffic to and from the pod is denied
  3. C.Only traffic within the same namespace is allowed
  4. D.Only traffic from system pods is allowed

Correct answer: B

In always mode, policy enforcement is enabled on all endpoints even if no rules select them, so a pod with no matching rule has all traffic denied (the docs note that health checks then need an explicit allow). Why the other options are wrong. "All traffic to and from the pod is allowed": that is the default mode before a policy selects the endpoint. "Only traffic within the same namespace is allowed": no enforcement mode adds an implicit namespace allow. "Only traffic from system pods is allowed": always mode has no system-pod exception.

Sources: Cilium docs: Policy Enforcement Modes, Cilium docs: Policy Enforcement

Question 2

Which policy enforcement mode in Cilium enforces policies only on endpoints that match at least one network policy?
  1. A.default
  2. B.always
  3. C.never
  4. D.selective

Correct answer: A

In default mode, endpoints have unrestricted access until a policy selects them; once selected, only allowed traffic passes (per direction). Why the other options are wrong. "always": enforcement applies to every endpoint even if no rule selects it. "never": enforcement is disabled on all endpoints, even those selected by rules. "selective": not a Cilium policy enforcement mode.

Sources: Cilium docs: Policy Enforcement Modes, Cilium docs: Policy Enforcement

Question 3

The agent runs with policyEnforcementMode: never. A CiliumNetworkPolicy selects app=db pods and allows ingress only from app=api pods. An app=web pod connects to an app=db pod. What happens?
  1. A.The connection is denied, because the policy selects the app=db pods
  2. B.The connection is denied, because never means deny everything
  3. C.It is allowed, because never disables all enforcement
  4. D.Only the first packet is allowed and later packets are dropped

Correct answer: C

In never mode, policy enforcement is disabled on all endpoints, even when rules select them. All traffic from any source (ingress) and to any destination (egress) is allowed. Why the other options are wrong. "The connection is denied, because the policy selects the app...": That is the default mode behaviour. never ignores the rules entirely. "The connection is denied, because never means deny everythin...": never disables enforcement. Denying everything that no rule allows is closer to always. "Only the first packet is allowed and later packets are dropp...": No mode works per packet like this. In never mode the whole connection is allowed.

Sources: CNCF CCA curriculum (CCA_Curriculum.pdf), Cilium docs: Policy Enforcement, Cilium docs: Policy Enforcement Modes

Practice this topic

Focus mode keeps every question on Policy Enforcement Modes until you leave it. 10 free guest answers, then a free account; no credit card.

Or open CCA practice across all topics.

Sources

The explanation above was checked against these official documents.

Frequently asked questions

Is never mode a way to test policies safely?

It disables enforcement completely, even for selected endpoints, so nothing is checked. It removes protection rather than simulating it.