Skip to content

Commit 266d6f8

Browse files
authored
Merge pull request #43438 from tssurya/fix-net-pol-connection-pkt-docs
Clarify NetPol applies to connections, not pkts
2 parents bfa079d + 991abfb commit 266d6f8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

content/en/docs/concepts/services-networking/network-policies.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,17 @@ By default, a pod is non-isolated for egress; all outbound connections are allow
5858
A pod is isolated for egress if there is any NetworkPolicy that both selects the pod and has
5959
"Egress" in its `policyTypes`; we say that such a policy applies to the pod for egress.
6060
When a pod is isolated for egress, the only allowed connections from the pod are those allowed by
61-
the `egress` list of some NetworkPolicy that applies to the pod for egress.
61+
the `egress` list of some NetworkPolicy that applies to the pod for egress. Reply traffic for those
62+
allowed connections will also be implicitly allowed.
6263
The effects of those `egress` lists combine additively.
6364

6465
By default, a pod is non-isolated for ingress; all inbound connections are allowed.
6566
A pod is isolated for ingress if there is any NetworkPolicy that both selects the pod and
6667
has "Ingress" in its `policyTypes`; we say that such a policy applies to the pod for ingress.
6768
When a pod is isolated for ingress, the only allowed connections into the pod are those from
6869
the pod's node and those allowed by the `ingress` list of some NetworkPolicy that applies to
69-
the pod for ingress. The effects of those `ingress` lists combine additively.
70+
the pod for ingress. Reply traffic for those allowed connections will also be implicitly allowed.
71+
The effects of those `ingress` lists combine additively.
7072

7173
Network policies do not conflict; they are additive. If any policy or policies apply to a given
7274
pod for a given direction, the connections allowed in that direction from that pod is the union of
@@ -456,6 +458,16 @@ implemented using the NetworkPolicy API.
456458
- The ability to prevent loopback or incoming host traffic (Pods cannot currently block localhost
457459
access, nor do they have the ability to block access from their resident node).
458460

461+
## NetworkPolicy's impact on existing connections
462+
463+
When the set of NetworkPolicies that applies to an existing connection changes - this could happen
464+
either due to a change in NetworkPolicies or if the relevant labels of the namespaces/pods selected by the
465+
policy (both subject and peers) are changed in the middle of an existing connection - it is
466+
implementation defined as to whether the change will take effect for that existing connection or not.
467+
Example: A policy is created that leads to denying a previously allowed connection, the underlying network plugin
468+
implementation is responsible for defining if that new policy will close the existing connections or not.
469+
It is recommended not to modify policies/pods/namespaces in ways that might affect existing connections.
470+
459471
## {{% heading "whatsnext" %}}
460472

461473
- See the [Declare Network Policy](/docs/tasks/administer-cluster/declare-network-policy/)

0 commit comments

Comments
 (0)