-
Notifications
You must be signed in to change notification settings - Fork 679
weave-npc doesn't handle named ports #3032
Comments
Yes, sorry, this should be documented. Named ports make the implementation hugely more complicated, as they can map to different numerical values on different pods. |
Mhm. Even if we can't easily implement it right now, I think the bug of it crashing and stopping all of your policies working for a whole cluster needs to be fixed, and just log an error message. |
Yes. Some way to surface the fact this isn't working without having to hunt through log files would be even better. |
Events API? |
Ref #2612 |
Aha! I just stumbled across this problem. Yeah, the pods crash when someone used named ports instead of numbered. I think it is ok to say, "use numbered ports only for The ports:
- protocol: TCP
port: rest And the
|
I'm adding the security label here, having a policy stop npc in the entire cluster and then leave things fail-open is bad. (We have namespaces which are expected to be in default deny where this wasn't applied due to the npc crashing) |
It's supposed to fail closed, i.e. if there isn't a rule allowing the connection then it will be blocked. Do you know the sequence of events under which it fails open? |
Probably |
The documentation for the port field of NetworkPolicyPort (https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#networkpolicyport-v1beta1-extensions) says
And even if it were only accepting numerical ports, ideally it should be rejected at the point of running |
Sadly that is extremely asynchronous from the Weave Net NPC code. |
Support for names ports in enhancement, but with this PR just adding more graceful failure. Fixes #3032
Support for names ports in enhancement, but with this PR just adding more graceful failure. Fixes #3032
#3375 just logs an error. |
Would it be possible to have #3375 included in a released version? |
@mikebryant support for |
I totally get that it's not actual support. The point for us is it's not just an error log - it also avoids the npc controller crashing, which is what I want. Good to hear about 4.5, thanks :) |
Suspect you mean 2.5 |
Oops sorry, yes its typo. I meant 2.5 release. |
Removed 'security' label as it no longer crashes and fails open. |
Hi, we were hit by the issue today, weave-npc container (version 2.5.1) exited with code=1 when a networkpolicy with named port was deployed:
FWIW, the PR in #3375 throws the error to the main.go and the error causes the process to exit with 1. So the weave pods are still crashlooping in k8s. Maybe I misunderstood what you meant by |
@yifan-gu please could you open a new issue for the crash, with more (perhaps all) of the logs. |
What you expected to happen?
For weave-npc not to crash
What happened?
I used a
NetworkPolicy
with a named port, as per https://kubernetes.io/docs/api-reference/extensions/v1beta1/definitions/#_v1beta1_networkpolicyportThis can either be a numerical or named port on a pod.
This causes weave-npc to crash
How to reproduce it?
Use a NetworkPolicy with a named port
Versions:
Logs:
The text was updated successfully, but these errors were encountered: