Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IP address (CIDR) exceptions in one rule affect other rules #121

Open
pgier opened this issue Jul 11, 2024 · 1 comment
Open

IP address (CIDR) exceptions in one rule affect other rules #121

pgier opened this issue Jul 11, 2024 · 1 comment

Comments

@pgier
Copy link

pgier commented Jul 11, 2024

I have a use case that I want to allow DNS port 53 to any IP address, but I want to restrict all other ports to only non-private IP addresses. I have the following policy which works fine using Calico. Switching to the AWS EKS VPC CNI addon, this policy no longer works. The second rule restricts the first rule so that DNS can no longer be accessed in the private network ranges.

  egress:
  - ports:
    - port: 53
      protocol: TCP
    - port: 53
      protocol: UDP
    to:
    - ipBlock:
        cidr: 0.0.0.0/0
  - to:
    - ipBlock:
        cidr: 0.0.0.0/0
        except:
        - 10.0.0.0/8
        - 172.16.0.0/12
        - 192.168.0.0/16

This behavior conflicts with the Kubernetes documentation which states that:

Network policies do not conflict; they are additive. If any policy or policies apply to a given pod for a given direction, the connections allowed in that direction from that pod is the union of what the applicable policies allow.

https://kubernetes.io/docs/concepts/services-networking/network-policies/#the-two-sorts-of-pod-isolation

@pgier
Copy link
Author

pgier commented Jul 11, 2024

This is similar issue to #98. Both issues seem to be a result of policies interfering with each other which shouldn't be possible based on the Kubernetes docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant