Pod lifecycle: is a non-normative note on the magnitude of the NetworkPolicy handling delay in scope?

Open Beginner friendly
#57,642 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
kubernetes

Research direction

Start with the Pod lifecycle section linked in the issue and review its existing NetworkPolicy ordering guidance. Use the reported measurements only to assess whether a non-normative statement about measurable, implementation-specific delay fits the concept page. Done means either an agreed documentation update is made or maintainers explicitly decide the note is out of scope.

Written by the indexing model from the issue text.

Description

language/en needs-triage sig/network

This is a Feature Request

What would you like to be added

A short, non-normative sentence in Pod lifecycle noting that the NetworkPolicy handling delay is implementation-specific and measurable out of band — or a maintainer's judgement that this is out of scope for a concept page, which is a perfectly good outcome and the reason this is filed as a question rather than a PR.

Why is this needed

The section currently says:

Every created NetworkPolicy will be handled by a network plugin eventually, but there is no way to tell from the Kubernetes API when exactly that happens.

and suggests an init container that waits for destinations to be reachable.

That is accurate, and #39875 already separated the two orderings clearly, so this is not a request to restate any of it.

The gap is magnitude. A reader cannot tell whether the unhandled interval is microseconds or minutes, and so cannot judge whether the init-container workaround is proportionate to their risk. "No way to tell from the Kubernetes API" is true and is the part that bites — but the delay is measurable out of band, and the page does not say so.

Comments

I measured it, so the question is concrete rather than hypothetical. Single-node kind, 180 trials, 30 per cell, pre-registered protocol.

Enforcement latency from issuing kubectl apply for a default-deny policy to traffic actually being blocked, with the Pod already Ready:

CNI median 95% CI
Antrea 2.7.0 51.1 ms [50.5, 52.7]
Calico v3.32.2 55.9 ms [55.2, 56.4]
Cilium 1.20.0 115.9 ms [104.4, 137.0]

All three pairs differ (Mann-Whitney, Holm-adjusted). Antrea and Calico finished enforcing before kubectl apply returned to the caller, in 30 of 30 trials each; Cilium in 0 of 30.

I also tested the ordering the page warns about. Creating the policy immediately after the victim Deployment's apply returned, all 90 such trials were already blocked at the harness's first look, on all three CNIs — the Pod never became Ready unprotected. Pod startup gave the plugin a 386–570 ms head start against that 51–116 ms latency.

These are single-node numbers and they are a floor, not an estimate. One node, one policy, one endpoint — everything that makes policy distribution hard in a real cluster is absent. I am not proposing the page carry any of these figures, and I would not want it to imply a normative value. The only thing I think the numbers establish is that the interval is bounded and measurable, which is what a reader deciding about init containers needs to know exists.

Method, pre-registration, raw-data checksums and reproduction steps: https://github.com/SomaTomita/k8s-netpol-enforcement-window

/sig network
/language en

Dominant language
HTML
Stars
5.4k
Forks
15.7k
Avg merge
4d 10h
Merged PRs (30d)
228

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from kubernetes/website

All issues in kubernetes/website

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.