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 doesn't work after restarting upstream pod without restarting nginx itself. #224
Comments
Hi @khteh , Can you share the yaml manifests needed for your deployment as well as instructions on how to reproduce the issue? Thanks |
Downstream: NodePort Service (svc-frontend) > Nginx Deployment (nginx) In no particular order: then, kubectl get all (Get the clusterIP which doesn't change because the nginx is still running). I have to do the following to resume the system which I am not sure is normal behaviour: kubectl get all (Note the cluster IP) |
@khteh It may be related to the fact that nginx when defining uptream address in proxy_pass config directive, nignx resolves dns name to ip only once. And if upstream ip address changes, he don't re-resolve it automatically. |
@andriy-f, sounds sensible. Is this a bug that needs to be fixed that changes to the upstream need to be propagated to the downstream? In this case, the detach / attach of upstream svc/pod to the nginx need to be know to nginx and trigger it to refresh itself. Simple observer pattern. |
Restarting nginx will cause service downtime to a production environment. |
@khteh This should not cause downtime |
How to use this with the nginx running in k8s cluster? |
Run as separate process alongside main nginx (hint: supervisord) which will trigger nginx -s ... |
How does it fit into the k8s cluster architecture? Does it need a separate deployment / pod? Just for that purpose? |
With reference to https://serverfault.com/questions/240476/how-to-force-nginx-to-resolve-dns-of-a-dynamic-hostname-everytime-when-doing-p/946404#946404, I change my nginx configuration accordingly but still doesn't work:
What is the right resolver address that should be used? |
@andriy-f I denfined svc name in Nginx configuration, instead of ip addr. it still can't work(need manually reboot Nginx after upstream server was restarted)
} |
@frankgululu did you set |
There have no manual setting...Kubeneters Service discovery can parse it... |
Please run
microk8s.inspect
and attach the generated tarball to this issue.We appreciate your feedback. Thank you for using microk8s.
My Nginx connects to upstream headless service which serves statefulset webapi. I restart both the statefulset and the headless service without the nginx and it results in 502 Bad Gateway. I have to restart nginx to get the whole to work again. Is this the expected behaviour?
The text was updated successfully, but these errors were encountered: