-
I'm trying to configure a Networkpolicy that should block Network-traffic from a specific external IP-address.
So the Network-range I specified here, is not the IP-range that is used internally in the K3s cluster, but in the network where also K3s is running. For some reason this is blocking all traffic from any IP-address outside of the cluster to all pods with the label service. But it should block it only for the one IP address is specified in the except list. Is this feature supported by the Kuberouter at all, or is it only for handling traffic between the pod, when they are talking directly with each other over internal network? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
That's not what it should do. As soon as you add a policy that matches a pod, only traffic matching the policy is allowed. The rule you've created will only allow traffic from 10.2.201.0/24, except 10.2.201.113. All other traffic will be blocked because it does not match any other ingress rules. |
Beta Was this translation helpful? Give feedback.
-
Maybe my explanation was not clear enough. The IP addresses that are allowed to send requests are all from the range 10.2.201.0/24 and the rule should allow it for all of this IP address range, except the one 10.2.201.113/32. But after activating this NetworkPolicy, all traffic was blocked, even the VM from which I tried to send a request had the IP 10.2.201.101/32, which should be allowed. What worked for me was using an Egress-Rule and allowing the IP 10.2.201.114/32 to send requests to everywhere, except 10.2.201.113/32. The IP range that is used internally within Kubernetes is not 10.2.201.0/24 by the way. |
Beta Was this translation helpful? Give feedback.
As noted in the upstream docs:
IP blocks are not meant to be used to target traffic from nodes. For example when using the flannel CNI plugin, traffic from a node to pods o…