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

In some cases k8s NetworkPolicy is not enforced when accessing a Service #3285

Open
brb opened this issue Apr 24, 2018 · 4 comments
Open

In some cases k8s NetworkPolicy is not enforced when accessing a Service #3285

brb opened this issue Apr 24, 2018 · 4 comments

Comments

@brb
Copy link
Contributor

brb commented Apr 24, 2018

In some cases a packet sent to a k8s Service won't enter the filter/FORWARD/WEAVE-NPC chain which means that a NetworkPolicy can be bypassed. Such cases are listed in the table found at #3284.

One way to fix this is to create the rule -t filter -A OUTPUT -o weave -j WEAVE-NPC. However, this would make the k8s health checks to enter the WEAVE-NPC chain. We could probably use iptables marks set by k8s to distinguish between health checks and a regular traffic.

@bboreham
Copy link
Contributor

I think the behaviour is deliberate because the rules for NetworkPolicy used to explicitly state that anything from the host was allowed. However when I last checked I couldn't find that text.

What mark are you thinking of?

@brb
Copy link
Contributor Author

brb commented Apr 24, 2018

What mark are you thinking of?

I was thinking about the one set in KUBE-MARK-MASQ, but from further inspection it's not applicable in all cases.

@brb
Copy link
Contributor Author

brb commented May 22, 2018

the rules for NetworkPolicy used to explicitly state that anything from the host was allowed

Aye, https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#networkpolicyingressrule-v1-networking-k8s-io : "Traffic is allowed to a pod <..> if the traffic source is the pod's local node"

@brb
Copy link
Contributor Author

brb commented May 22, 2018

However, we should do something about the 10th case: https://github.com/weaveworks/weave/blob/master/docs/k8s-src-ip.md

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

No branches or pull requests

2 participants