Skip to content

NPEP-127: Add southbound traffic support in ClusterNetworkPolicy API#371

Open
tssurya wants to merge 2 commits into
kubernetes-sigs:mainfrom
tssurya:npep-127-ingress-networks
Open

NPEP-127: Add southbound traffic support in ClusterNetworkPolicy API#371
tssurya wants to merge 2 commits into
kubernetes-sigs:mainfrom
tssurya:npep-127-ingress-networks

Conversation

@tssurya

@tssurya tssurya commented Apr 5, 2026

Copy link
Copy Markdown
Contributor
  • Update terminology from (B)ANP to ClusterNetworkPolicy
  • Fill in API section with networks and nodes fields on IngressPeer
  • Update API field descriptions to match egress side exactly
  • Add YAML examples for allow-from-CIDR and zero-trust patterns
  • Rewrite use cases to follow standard user story template
  • Add BGP/VM and ExternalTrafficPolicy=Local focused stories
  • Add Baseline tier and zero trust stories (refs [BUG] AdminNetworkPolicy Core can't express allow/deny all #248)
  • Move source IP preservation into introduction with BGP examples
  • Add Expected Behavior section covering source IP semantics,
    node.Status.Addresses matching, internal traffic, and kubelet
    probes (refs KEP-4559, CNP vs kubelet probes #314)
  • Add TBDs for secondary node IPs and allow-same-node semantic
  • Add conformance, alternatives, and references sections

npinaeva and others added 2 commits April 5, 2026 20:05
Signed-off-by: Nadia Pinaeva <npinaeva@redhat.com>
- Update terminology from (B)ANP to ClusterNetworkPolicy
- Fill in API section with networks and nodes fields on IngressPeer
- Update API field descriptions to match egress side exactly
- Add YAML examples for allow-from-CIDR and zero-trust patterns
- Rewrite use cases to follow standard user story template
- Add BGP/VM and ExternalTrafficPolicy=Local focused stories
- Add Baseline tier and zero trust stories (refs kubernetes-sigs#248)
- Move source IP preservation into introduction with BGP examples
- Add Expected Behavior section covering source IP semantics,
  node.Status.Addresses matching, internal traffic, and kubelet
  probes (refs KEP-4559, kubernetes-sigs#314)
- Add TBDs for secondary node IPs and allow-same-node semantic
- Add conformance, alternatives, and references sections

Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
@netlify

netlify Bot commented Apr 5, 2026

Copy link
Copy Markdown

Deploy Preview for kubernetes-sigs-network-policy-api ready!

Name Link
🔨 Latest commit 70dce28
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-network-policy-api/deploys/69d2aeb55e29380008816288
😎 Deploy Preview https://deploy-preview-371--kubernetes-sigs-network-policy-api.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tssurya

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from aojea and danwinship April 5, 2026 18:49
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 5, 2026
Comment thread npeps/npep-127.md

## Non-Goals

* N/A

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* Defining strict semantics for the source IPs of cluster-ingress traffic

Comment thread npeps/npep-127.md
[Ingress API](https://kubernetes.io/docs/concepts/services-networking/ingress/),
[Gateway API](https://gateway-api.sigs.k8s.io/), or downstream
implementations like
[Openshift's Route API](https://docs.openshift.com/container-platform/4.13/rest_api/network_apis/route-route-openshift-io-v1.html).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[Openshift's Route API](https://docs.openshift.com/container-platform/4.13/rest_api/network_apis/route-route-openshift-io-v1.html).
[OpenShift's Route API](https://docs.openshift.com/container-platform/4.13/rest_api/network_apis/route-route-openshift-io-v1.html).

Comment thread npeps/npep-127.md
original source IP is visible to the policy enforcement point.

In some deployments, pod IPs are directly routable from external
networks via BGP, and source IP is naturally preserved:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
networks via BGP, and source IP is naturally preserved:
networks, and source IP is naturally preserved:

Comment thread npeps/npep-127.md
//
// TBD: What about secondary node IPs or internal management
// IPs that are not in node.Status.Addresses? It's pretty hard
// to solve the case of ignoring externalIPs, egressIPs, KVIPs...and other corner cases

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't say "you can deny traffic from Node A to Pod B, but anybody on Node A can bypass the rule just by binding to an alternative source IP".

So either:

  1. The policy must apply to every IP on Node A which can be used for traffic between Node A and Pod B. OR
  2. Nodes ingress rules, like DomainNames egress rules, can only be Accept, not Deny (and then presumably apply to "whatever IP would be picked by default when routing a packet from Node A to Pod B", or maybe that plus node.status.addresses)

Comment thread npeps/npep-127.md
// well. So if you Accept or Deny traffic from "0.0.0.0/0", that will allow
// or deny all IPv4 pod-to-pod traffic as well. If you don't want that,
// add a rule that Passes all pod traffic before the Networks rule.
//

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need at least some of the "expected behavior" text from below here

Comment thread npeps/npep-127.md
Comment on lines +249 to +252
2. In deployments where pod IPs are directly routable (e.g. via BGP
with no overlay), the source IP of external traffic is the original
client IP. The `networks` peer will match against this IP as
expected.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't say for sure that it's the "original" client IP, because the traffic may already have been masqueraded before it got to you. I would just drop this point.

Comment thread npeps/npep-127.md
IP by kube-proxy or the load balancer. In this case:
- If `externalTrafficPolicy: Local` or equivalent source IP
preservation is configured, the original client IP is preserved
and can be matched by the `networks` peer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be split out into a separate point; right now you're saying that in the case where the traffic has been masqueraded, if it's eTP:Local, it won't have been masqueraded...

Comment thread npeps/npep-127.md
- If source IP is not preserved, the `networks` peer will match
against the translated (e.g. node) IP, not the original client
IP. This is expected behavior -- the implementation matches what
it sees.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a Nodes peer allows from Node A, and traffic arrives at a NodePort on Node A and gets masqueraded, then does that imply it's accepted by the policy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants