-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
NGINX 502 Bad Gateway when using a single replication #4375
Comments
@BuddhiWathsala can you change the service to the loadbalancer type and run two tests simultaneously, one hitting the ingress the other hitting the loadbalancer endpoint. |
@dcherniv I ran the two tests. When we are using single replica the LoadBalancer configuration also have a downtime. As far as I understand the problem resides in pod level. When we do some changes to the deployment, then the existing pod will start to terminate. The HTTP connections that currently established with that pod give 502 bad gateway because that pod can no longer be able to process requests. But I have a confusion why this problem might not arise when I have multiple pods. When I have multiple pods, did NGINX controller intelligently redirect error requests to other available pods without returning an error to the user? |
@BuddhiWathsala
with following spec |
@dcherniv I have a deployment. Also, I agree with your argument. As far as I understand now the problem might be in pod level. Which means at the termination time pod has some HTTP connections that already being established. When pod receives SIGTERM, pod terminate immediately and pod unable to send responses to the already established connections. Therefore we get 502 response. Since this was not an issue in ingress-nginx I can close the issue. But I have a thing to clarify as I asked previously. I don't understand why this 502 response did not receive when I have 2 pods?. When I have 2 pods, did NGINX controller intelligently redirect error requests to another available pod without returning an error to the user? |
@BuddhiWathsala When idempotent request (for example GET method) fail, NGINX can config to retry. In that scenario ,upstream field in access log of retryed request will have multi value.You can check it. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Is this a request for help? No
What keywords did you search in NGINX Ingress controller issues before filing this one? nginx-ingress, zero-downtime, single replica
Is this a BUG REPORT or FEATURE REQUEST? : BUG REPORT
NGINX Ingress controller version: 0.23.0
Kubernetes version (use
kubectl version
): v1.15.0Environment: minikube version: v1.2.0
What happened:
I need to deploy an HTTP app with zero-downtime. Here I have a restriction of using single pod only. So I had problems with some of the HTTP requests get 502 bad gateway when I was using an NGINX ingress.
I followed these answers given in these two issues(#489 and #322). The answers to these issues work fine when I was using more than a single replica. But for a single replica, NGINX still have a slight downtime which is less than 1 millisecond.
The lifecycle spec and rolling updates spec of my deployment set as below according to the answers given by the above issues.
Note that I have config maps that mount to this deployment. I'm not sure that would affect to this downtime or not.
Also, I refer the following blogs but it didn't work for this single pod scenario.
[1]: https://blog.sebastian-daschner.com/entries/zero-downtime-updates-kubernetes
[2]: http://rahmonov.me/posts/zero-downtime-deployment-with-kubernetes/
What you expected to happen:
Pod receives HTTP request without a downtime.
How to reproduce it :
kubectl apply
. Then you will see missing HTTP requests.Anything else we need to know:
According to the blog [2], we can achieve zero downtime even with single replication of pod without ingress. But why it cannot be achievable when I used NGINX ingress?
The text was updated successfully, but these errors were encountered: