I was hoping to follow this architecture:
-> service 1 -> nginx -> service 2 -> service 3
The reason I want to use nginx (instead of the default kube services using kube-proxy) is that it has x-accel-redirects which is great for authentication. Normally, nginx and all three services would be on separate boxes.
With Kubernetes, I'm trying to find the best way of architecting this. I know there's a way to do it by simulating the service proxying, but this seems like a jenky approach. I was thinking to make nginx and all three services a kube service, so the flow would be
-> kube-proxy -> nginx -> kube-proxy -> service 1, 2, 3
and the nginx config would look like
upstream backend {
server backend1.example.com; # with skydns name, or the service ip which is static
}
server {
location / {
proxy_pass http://backend;
}
}
I was wondering if there are any downsides to this approach, and if there are any better approaches? Seems like a request will go through quite a bit of hops and processing.
Thanks!
You might be interested in our new Ingress API and load-balancer controllers (beta in kubernetes v1.1) We have HAProxy support, but not nginx (yet).
https://github.com/kubernetes/contrib/tree/master/service-loadbalancer