<p>I was hoping to follow this architecture:</p>
<pre><code>           -&gt; service 1
-&gt; nginx   -&gt; service 2
           -&gt; service 3
</code></pre>
<p>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.</p>
<p>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 <a href="http://paulbakker.io/kubernetes/load-balancing-kubernetes/" rel="nofollow noreferrer">service proxying</a>, 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</p>
<p>-&gt; kube-proxy -&gt; nginx -&gt; kube-proxy -&gt; service 1, 2, 3</p>
<p>and the nginx config would look like</p>
<pre><code>upstream backend {
  server backend1.example.com; # with skydns name, or the service ip  which is static
}

server {
  location / {
    proxy_pass http://backend;
  }
}
</code></pre>
<p>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.</p>

<p>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).</p>

<p><a href="https://github.com/kubernetes/contrib/tree/master/service-loadbalancer" rel="nofollow">https://github.com/kubernetes/contrib/tree/master/service-loadbalancer</a></p>
