Kubernetes: how to connect to service from outside the cluster?

2/17/2017

I have created a service using this manual: https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address-service/

The service has IP in this example (10.32.0.16, by kubectl describe services example-service command) and we can create proxy_pass rule: proxy_pass http://10.32.0.16:8080; in external (outside the cluster) nginx.

This IP is always different (it depends on number of services, etc..). How can I specify this service for my external nginx?

-- Dmitry
kubernetes
nginx
proxypass

3 Answers

2/17/2017

You can either:

-- ccshih
Source: StackOverflow

2/18/2017

An alternative, that I found very powerful, is to setup the nginx inside the cluster using the official nginx ingress controller.

Then you can have both load-balanced/HA nginx and have kubernetes automatically update its config from ingress rules.

-- Emil Ingerslev
Source: StackOverflow

5/12/2018

At the moment Traefik seems very popular for such cases. It's taking over nginx ingress too...

-- Jan
Source: StackOverflow