question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nginx doesn't work after restarting upstream pod without restarting nginx itself.

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
khtehcommented, Dec 23, 2018

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:

        listen 80;
        access_log /var/log/nginx/app.access_log main;
        error_log /var/log/nginx/app.error_log;
        resolver 127.0.0.1 [::1]:5353 valid=10s;
        set $upstream http://svc-web;
        location / {
          proxy_pass $upstream;
          proxy_http_version 1.1;
        }
      }

What is the right resolver address that should be used?

0reactions
frankgululucommented, Feb 25, 2019

There have no manual setting…Kubeneters Service discovery can parse it… The Nginx still work until the upstream server(Pod) was reboot…And it works again after reboot Nginx

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nginx doesn't work after restarting upstream pod ... - GitHub
My Nginx connects to upstream headless service which serves statefulset webapi. I restart both the statefulset and the headless service without ...
Read more >
How to make a modification take affect without restarting nginx?
I wrote about how to restart nginx with zero downtime a while ago. This may be helpful for you.
Read more >
Nginx container not restarting after shutdown in Kubernetes
This seems to be working as a failsafe to ensure that if the internal nginx process stops or doesn't even start, the container...
Read more >
1725248 – nginx does not start after server reboot with "host ...
Description of problem: nginx does not start during server reboot with following error message: host not found in upstream "example.com" in ...
Read more >
Gracefully Restart Nginx Web Server After Config Update
Explains how to restart the Nginx web server gracefully without t interrupting users current session under Linux/Unix/ *BSD operating ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found