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

Allow ip_hash for backends #94

Closed
sajal opened this issue Dec 5, 2016 · 6 comments
Closed

Allow ip_hash for backends #94

sajal opened this issue Dec 5, 2016 · 6 comments

Comments

@sajal
Copy link

sajal commented Dec 5, 2016

The controller should accept some annotation to indicate client affinity, if so then set ip_hash in the upstream block.

@pleshakov
Copy link
Contributor

We can solve it by solving a general problem of specifying a load balancing method: least_conn, ip_hash, general hash (https://www.nginx.com/resources/admin-guide/load-balancer/#method)

We can have an annotation and a Config map key for that:
nginx.org/default-lb-method / default-lb-method
If it's not set, the default round-robin method will be used.

Additionally, it makes sense to add an annotation that allows specifying a method per service, similar to https://github.com/nginxinc/kubernetes-ingress/tree/master/examples/rewrites.
`nginx.org/lb-method: "serviceName=service1 method=method1[;serviceName=service2 method=method2;...]"

Let me know what you think.

@sajal
Copy link
Author

sajal commented Dec 6, 2016

+1 for nginx.org/default-lb-method . Shall I attempt to implement it? Or wait for design to be settled?

Alternatively, you could look at the service's sessionAffinity to configure per-service lb-method.

"By default, the choice of backend is round robin. Client-IP based session affinity can be selected by setting service.spec.sessionAffinity to "ClientIP" (the default is "None")."

But this only gives you the option between ip_hash and the default round-robin.

@pleshakov
Copy link
Contributor

@sajal

+1 for nginx.org/default-lb-method . Shall I attempt to implement it? Or wait for design to be settled?

That'd be great if you could add it.

Alternatively, you could look at the service's sessionAffinity to configure per-service lb-method... But this only gives you the option between ip_hash and the default round-robin.

I think it's better to add more options then the two options available with the service session Affinity property.

@sajal
Copy link
Author

sajal commented Dec 7, 2016

Will get my hands dirty and attempt to implement annotation and config map setting this week or weekend. For my PoC I simply hardcoded ip_hash; into the template.

@quasiben
Copy link

quasiben commented Aug 9, 2017

Is this still something being developed ?

@sajal
Copy link
Author

sajal commented Aug 9, 2017

I still need this for a service I need to migrate inside my Kubernetes cluster. However I currently do not have time to work on it for next few weeks.

I will post here when I do begin working on it. In case someone else is working on it in the meantime, please update this thread so we don't duplicate effort.

pleshakov added a commit that referenced this issue Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants