-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[CNI] network mode bridge doesn't allow hairpin #13352
Comments
Hi @ygersie Thanks for reporting this issue, and for providing a potential solution! I'll take a look at what you've got here and then discuss where it might fit in the roadmap. Also, feel free to submit a PR to add the configuration. You might get to it more quickly than we do, and community PRs are always welcome! |
Thanks for the update. Yeah, I'd like to mainly confirm that this wouldn't cause any adverse side effects. Afaict there should not be any implications. If you guys agree I'm happy to push the change to make it a default setting. |
I don't know that we could set it as the default. Some quick research seems to indicate that not all CNI implementations support it. I think the PR would need to default to false but allow user configuration to enable hairpin mode. |
@DerekStrickland it may not be supported by all CNI implementations but this is specifically the one used to setup:
which is used to setup port forwarding using the CNI plugins and also required when using Consul Connect. Afaik it won't affect any other (user supplied) configurations. But if there might be other issues then it definitely needs to be configurable. Please let me know what you think. |
Hi @ygersie, hope you're doing well! I think another thing to keep in mind here is the backwards compatibility and behaviour consistency when updating the built-in CNI configuration. I wonder if we could add a new client configuration parameter similar to |
This seems to be required to run most clustering applications. This includes apps like grafana loki, and cassandra. The two workarounds are:
|
Tried my hand at implementing this in |
Thanks @A-Helberg completely dropped off my radar again. |
Also ran into this issue and saw that hairpinning packets send a SYN and never receive an ACK. Packet tracing logs through the iptables rules didn't seem to reveal anything out of the ordinary. Glad there is a fix/option coming for this, thanks! |
I've left a comment here (#13834 (review)) about whether we should implement this via exposing the CNI config directly (as in #13824), rather than adding another config knob. |
Closing this one as completed by #15961. While there have been discussions about a more flexible configuration approach, after further discussion we feel like adding more customization to the default Users that require more advanced customization are able to create their own bridge network using CNI. The main downside of this is that Consul Service Mesh requires Feel free to 👍 and add more comments there. Thank you everyone for the feedback! |
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
When spinning up a job that uses CNI to setup the forwarding the container can't reach itself on the host port. This probably isn't a very common use case but when deploying a container that needs to discover itself and its peers through a Consul endpoint we get back the host IP + Port including itself. The connection towards the endpoint that references itself will then not work and gives timeouts. You can reproduce with the following job:
And then from the container a netcat times out:
/ # nc -v ${NOMAD_HOST_IP_foo} ${NOMAD_HOST_PORT_foo}
I compiled a version of Nomad with hairpinMode enabled in the nomadCNIConfigTemplate which resolves the issue.
Can this be made either configureable or enabled by default or is there any particular reason why I wouldn't want this?
The text was updated successfully, but these errors were encountered: