Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Nginx Ingress Controller - Routing to service #829

Closed
nottix opened this issue Apr 22, 2016 · 19 comments
Closed

Nginx Ingress Controller - Routing to service #829

nottix opened this issue Apr 22, 2016 · 19 comments

Comments

@nottix
Copy link

nottix commented Apr 22, 2016

Hi,

i found that "Nginx Ingress Controller" routes all traffic directly to pod bypassing services, why?
@aledbf

Thank you.

@aledbf
Copy link
Contributor

aledbf commented Apr 22, 2016

@nottix to delegate the load balancing to nginx and be able to use sticky session (EnableStickySessions option)

@nottix
Copy link
Author

nottix commented Apr 22, 2016

Using this way is it possible that Pod (that was deleted and recreated) IP inside Nginx is not synched with the new current Pod IP?
I'm having this problem with 2-3 of our 30 pods.

@aledbf
Copy link
Contributor

aledbf commented Apr 22, 2016

@nottix please add --v=2 to see the delay in the controller to changes in pods (it will show the diff in nginx.conf).

IP inside Nginx is not synched with the new current Pod IP?

I never saw this behavior. Please change the --v flag to see what's happening

@nottix
Copy link
Author

nottix commented Apr 22, 2016

Ok @aledbf , i'm running a local instance of controller to monitoring the differences.

To enable sticky session on nginx is required ip_hash parameter or i'm wrong? In the nginx.tmpl i see least_conn.

@aledbf
Copy link
Contributor

aledbf commented Apr 22, 2016

@nottix ip_hash is not a "real" sticky session. This functionality is only available in the comercial version of nginx. That's the reason why I'm adding the nginx-sticky-module-ng module in #825

@nottix
Copy link
Author

nottix commented Apr 22, 2016

Ah ok, thank you @aledbf

@nottix nottix closed this as completed Apr 22, 2016
@nottix
Copy link
Author

nottix commented Apr 22, 2016

Last question: if i want to use sticky session now, i should wait for integration of nginx-sticky-module-ng ?

@aledbf
Copy link
Contributor

aledbf commented Apr 22, 2016

@nottix if you can wait, I will try to get #825 and #766 before monday

@nottix
Copy link
Author

nottix commented Apr 22, 2016

@aledbf it would be great! Thanks.

I have to go on production with big portal that expects 30000 visitors weekly :-)

@nottix
Copy link
Author

nottix commented Apr 22, 2016

We actually place pod IP on upstream instead of service IP.

I found that Kubernetes 1.1 was introduced "Proxy-mode: iptables" on service, so why don't leverage on service layer for dispatching requests to pods instead of replicate load balance feature with nginx upstream?

@nottix nottix reopened this Apr 22, 2016
@aledbf
Copy link
Contributor

aledbf commented May 4, 2016

so why don't leverage on service layer for dispatching requests to pods instead of replicate load balance feature with nginx upstream?

because is not possible to specify things like how to balance or use sticky sessions

Please check the new version gcr.io/google_containers/nginx-ingress-controller:0.61. It contains the sticky sessions module.

@aledbf
Copy link
Contributor

aledbf commented Jun 28, 2016

so why don't leverage on service layer for dispatching requests to pods instead of replicate load balance feature with nginx upstream?

Please check this answer #1140 (comment)

@nottix
Copy link
Author

nottix commented Jun 28, 2016

Thank you

@nottix nottix closed this as completed Jun 28, 2016
@jsindy
Copy link

jsindy commented Oct 18, 2016

Can someone link how to enable sticky sessions for the nginx ingress controller? Having some trouble finding it.

@dgoujard
Copy link

dgoujard commented Oct 30, 2016

Hi,

I'm looking to enable sticky sessions too. I tried to add this configmap but it's didn't affect the ingress controller (also with manual pod kill):

apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-ingress-controller
data:
enable-sticky-sessions: 'true'

Edit : i found the solution, you need to add this argument in the ingress controller :

  • --nginx-configmap=$(POD_NAMESPACE)/nginx-ingress-controller

@jsindy
Copy link

jsindy commented Oct 31, 2016

@dgoujard if you figure it out, please post back!

@aledbf
Copy link
Contributor

aledbf commented Oct 31, 2016

@jsindy you need to specify the configmap (--nginx-configmap) that contains the custom configuration for the ingress controller

@jsindy
Copy link

jsindy commented Oct 31, 2016

Perfect! thanks

@julianvmodesto
Copy link

Hi @aledbf, could you please elaborate what you mean by your statement about ip_hash below?

@nottix ip_hash is not a "real" sticky session. This functionality is only available in the comercial version of nginx. That's the reason why I'm adding the nginx-sticky-module-ng module in #825

It looks like ip_hash is available in NGINX and not just in NGINX Plus, the commercial version, based on this article.

Would applying the ip_hash upstream directive work? I'm looking for Client IP affinity without the use of cookies.

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

No branches or pull requests

6 participants