<p>I have 6 HTTP micro-services.  Currently they run in a crazy bash/custom deploy tools setup (dokku, mup).  </p>

<p>I dockerized them and moved to kubernetes on AWS (setup with kop).  The last piece is converting my nginx config.</p>

<p>I'd like </p>

<ol>
<li>All 6 to have SSL termination (not in the docker image)</li>
<li>4 need websockets and client IP session affinity (Meteor, Socket.io) </li>
<li>5 need http->https forwarding</li>
<li>1 serves the same content on http and https</li>
</ol>

<p>I did 1. SSL termination setting the service type to LoadBalancer and <a href="https://github.com/kubernetes/kubernetes/issues/22854" rel="nofollow noreferrer">using AWS specific annotations</a>.  This created AWS load balancers, but this seems like a <a href="https://github.com/kubernetes/kubernetes/issues/13892" rel="nofollow noreferrer">dead end for the other requirements</a>.</p>

<p>I looked at Ingress, but don't see how to do it on AWS.  Will this <a href="https://github.com/kubernetes/contrib/blob/master/ingress/controllers/README.md" rel="nofollow noreferrer">Ingress Controller</a> work on AWS?</p>

<p>Do I need an nginx controller in each pod?  <a href="https://stackoverflow.com/questions/35322432/running-meteor-app-with-nginx-ssl-proxy-on-kubernetes">This</a> looked interesting, but I'm not sure how recent/relevant it is.</p>

<p>I'm not sure what direction to start in.  What will work?</p>

<p>Mike</p>

<p>You should be able to use the <a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx" rel="noreferrer">nginx ingress controller</a> to accomplish this.</p>

<ol>
<li><a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx#https" rel="noreferrer">SSL termination</a></li>
<li><a href="https://github.com/kubernetes/contrib/blob/master/ingress/controllers/nginx/configuration.md#websockets" rel="noreferrer">Websocket support</a></li>
<li><a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx#server-side-https-enforcement" rel="noreferrer">http->https</a></li>
<li>Turn off the http->https redirect, as described in the link above</li>
</ol>

<p>The <a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx" rel="noreferrer">README</a> walks you through how to set it up, and there are plenty of <a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx/examples" rel="noreferrer">examples</a>.</p>

<p>The basic pieces you need to make this work are:</p>

<ul>
<li>A <a href="https://github.com/kubernetes/contrib/blob/master/ingress/controllers/nginx/rc.yaml" rel="noreferrer">default backend</a> that will respond with 404 when there is no matching Ingress rule</li>
<li>The <a href="https://github.com/kubernetes/contrib/blob/master/ingress/controllers/nginx/rc.yaml" rel="noreferrer">nginx ingress controller</a> which will monitor your ingress rules and rewrite/reload nginx.conf whenever they change.</li>
<li>One or more <a href="https://github.com/kubernetes/contrib/blob/master/ingress/controllers/nginx/examples/ingress.yaml" rel="noreferrer">ingress rules</a> that describe how traffic should be routed to your services.</li>
</ul>

<p>The end result is that you will have a single ELB that corresponds to your nginx ingress controller service, which in turn is responsible for routing to your individual services according to the ingress rules specified.</p>
