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

expose hostnetwork option #49

Merged
merged 2 commits into from Mar 12, 2020
Merged

expose hostnetwork option #49

merged 2 commits into from Mar 12, 2020

Conversation

rbtr
Copy link
Contributor

@rbtr rbtr commented Dec 20, 2019

What:
adds hostNetwork and an example anti-affinity for hostnetwork compatibility.

Why:
I want traefik to bind to the node ports 80/443, but a NodePort service can only bind to ports >3000 (unless k8s is specifically configured to allow a different NodePort range which is not recommended). The only option in this situation is to run the pod in the host network namespace...
But if the pod is running in the host network, we can't schedule more than one per node, because the port will become in-use as soon as the first pod starts, so it is necessary to spread them out among the nodes when we have more than one pod replica.

Closes #99

@mmatur
Copy link
Member

mmatur commented Mar 10, 2020

Hi @rbtr

Thanks for your contribution.

Regarding the hostNetwork, what is your use case?
Why you need to bind traefik to the node ports 80/443?

I am closing this PR because affinity and env have already been implemented.

Could you please open an issue to start a discussion about the hostNetwork. We need to understand the use case behind the needs to bind traefik to node ports 80/443.

Thanks

@mmatur
Copy link
Member

mmatur commented Mar 12, 2020

@rbtr After a discussion with the Traefik team we have decided to reopen this PR.

@mmatur mmatur reopened this Mar 12, 2020
@mmatur mmatur added the kind/enhancement New feature or request label Mar 12, 2020
@mmatur
Copy link
Member

mmatur commented Mar 12, 2020

@rbtr Could you please rebase your PR

traefik/templates/deployment.yaml Outdated Show resolved Hide resolved
@ldez ldez changed the title make hostnetwork, affinity, and env customizable make hostnetwork Mar 12, 2020
adds hostNetwork, affinity, and env customization to the values.yaml
in the deployment template, adds hostNetwork, affinity (more on this below) and env templates hooks.
in the deployment template, adds logic that checks if:
 - the pod is running in the host network
 - the deployment has >1 replica specified
 - there are no antiaffinity rules specified
and injects a default pod anti-affinity that will schedule traefik pods on individual nodes (kind of like daemonset behavior, except only on as many nodes as replicas requested)
@rbtr
Copy link
Contributor Author

rbtr commented Mar 12, 2020

@mmatur rebased and cleaned up per review comments!

@rbtr rbtr changed the title make hostnetwork expose hostnetwork option Mar 12, 2020
Copy link
Member

@mmatur mmatur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rbtr Thanks

Could you please update the Chart version

Copy link
Member

@mmatur mmatur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@traefiker traefiker merged commit 55798d1 into traefik:master Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose hostNetwork customization
3 participants