0

Trying nginx on kubernetes to access services running at different ports.

Intially when all the services deployed and nginx deployed at the last then i see everything working fine.

If any of the services updated/restarted , nginx unable to access that particular service.

server {
    location / {
        proxy_pass http://backends.example.com:8080;
    }
}

and will be able to access the service only if I restart the nginx through

nginx -s reload 

Anyway to make nginx detect/poll to reflect the services restarts (Service Discovery with DNS)

charan kumar
  • 335
  • 2
  • 11
  • 1
    Are you running nginx manually? If so, I strongly recommend to have a look at Ingresses and the nginx Ingress Controller: https://kubernetes.io/docs/concepts/services-networking/ingress/ https://github.com/kubernetes/ingress/tree/master/controllers/nginx – slintes Sep 13 '17 at 08:06
  • @MarcSluiter : I was actually implementing own api-gate way(in a new pod deployed other than nginx that works with ingress). – charan kumar Sep 13 '17 at 10:44

1 Answers1

1

Service never "restarts", and it's ClusterIP never changes (well, that is unless you delete and recreate the service), so you don't need to watch for changes in the backing endpoints at all as this is in a way what kube-proxy does for you.

Radek 'Goblin' Pieczonka
  • 21,554
  • 7
  • 52
  • 48