title: Kubernetes on AWS with NGINX ingress controller and SSL termination
body: <p>Having issues configuring SSL termination in my Kubernetes cluster. Attempting to figure out best place for this to happen.</p>
  
  <p>I have been able to get it working following the instructions listed <a href="https://github.com/kubernetes/ingress-nginx/blob/master/deploy/README.md" rel="nofollow noreferrer">here</a> and then updating the ingress controller service to include the SSL certificate details using <strong>service.beta.kubernetes.io/aws-load-balancer-ssl-cert</strong> annotation:</p>
  
  <pre><code>kind: Service
  apiVersion: v1
  metadata:
    name: ingress-nginx
    namespace: ingress-nginx
    labels:
      app: ingress-nginx
    annotations:
      service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
      service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:...
  spec:
    type: LoadBalancer
    selector:
      app: ingress-nginx
    ports:
    - name: https
      port: 443
      targetPort: 80
  </code></pre>
  
  <p>I then have ingress rules and services setup similar to:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: app1
    annotations:
      kubernetes.io/ingress.class: nginx
  spec:
    rules:
    - host: app1.foo.bar
      http:
        paths:
        - backend:
            serviceName: app1
            servicePort: 80
  
  ---
  
  apiVersion: v1
  kind: Service
  metadata:
    name: app1
  spec:
    type: LoadBalancer
    ports:
    - name: http
      port: 80
      targetPort: 80
    selector:
      app: app1
  
  ---
  
  apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: app1
  spec:
    template:
      metadata:
        labels:
          app: app1
      spec:
        containers:
        - image: nginx
          name: nginx
          ports:
          - containerPort: 80
  </code></pre>
  
  <p>When going to <code>app1.foo.bar</code> I can see that:</p>
  
  <ul>
  <li>http requests are redirected to https</li>
  <li>the SSL certificate is correctly applied</li>
  </ul>
  
  <p>Originally I was trying to apply the certificate to my individual app services. I could see the certificate being applied to the ELB in AWS but wasn't being passed through. So my question is:</p>
  
  <p>Is this the correct configuration or is there a better solution?</p>
  
  <p>Thank you :)</p>