Search code examples
amazon-web-servicessslkubernetesamazon-elbkops

Add SSL to a domain serving kubernetes app


I am using kops to deploy my kubernetes cluster. in my cluster, I have a simple Nginx deployment, a service, and an ingress. Its configured with route 53 (not using external DNS, manually creating A record in route 53 pointing to a classic load balancer (generated by kops)).

I can hit the domain www.XXXX.com as well as a subdomain on it but, there is not SSL certificate on it.

I know we can apply SSL on the loadbalancer. So, went in ACM, created a certificate and when I try to apply it, I see 80 and 443 are serving TCP traffic, that's why I cannot add these two ports serving HTTP and HTTPS with certificate (as shown in image) enter image description here

If I delete the two TCP listeners and add HTTP and HTTPS listners I can, but then my app is not reachable on the domain.

How can I configure ACM on this loadbalancer. Is this even a correct way of adding https for an app deployed on Kubernetes?

I know about https://kubernetes.github.io/ingress-nginx/user-guide/tls/, but if there is a way to do it using above approach I would prefer that.


UPDATE 1:

when I describe my nginx pod I see Ports as follows:

Ports:         80/TCP, 443/TCP

shouldn't that be

Ports:         80/HTTP, 443/HTTPS

?


Solution

  • Turns out I deployed the ingress controller incorrectly.

    the documentation clearly says download and update values in the file before applying I missed the updating part.

    You have to update CIDR proxy-real-ip-cidr and service.beta.kubernetes.io/aws-load-balancer-ssl-cert

    literally that all you need.

    make sure you are creating a certificate before applying this YAML file.

    and while creating cert add

    DOMAIN.com
    *.DOMAIN.com

    both to make it work.