In this article, we are going to learn how to install Ngix Ingress Controller in EKS with enabled SSL. AWS recommends using ALB Controller for EKS Cluster but there are some limitations in ALB Controller. So we are going to use Ngix Ingress Controller for our EKS Cluster. Let's get started.
Prerequisite
EKS Cluster
Add Helm Repository
In here we are going to use Helm to install Ngix Ingress Controller. So first we need to add Helm repository to our local machine. To do that run below command.
And also we can see the installed Ngix Ingress Controller pods by running below command.
1
kubectl get pods -n nginx-ingress
Output will be like below.
1 2
NAME READY STATUS RESTARTS AGE nginx-ingress-controller-95fc5f944-qj6sg 1/1 Running 0 5d6h
Verify the LoadBalancer is created or not by running below command.
1
kubectl get services -n nginx-ingress
Output will be like below.
1 2
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE nginx-ingress-ingress-nginx-controller LoadBalancer 10.100.20.84 af5836566fac145d9a649bb18c6376f0-XXXXXXXXX.us-east-2.elb.amazonaws.com 80:31105/TCP,443:31746/TCP 5d6h
Make sure to copy the EXTERNAL-IP. We need to use this EXTERNAL-IP to map our domain name.
Map the Domain 2048..com
Now we need to map the domain 2048.your-domain-name.com (this will be our sub-domain we are going to map out demo application) to the LoadBalancer EXTERNAL-IP. To do that we need to create a CNAME record in our DNS provider. Here I am using AWS Route53 as my DNS provider. If you need to learn How to add a domain with Amazon Route 53, please refer article .So I am going to create a CNAME record in Route53. If you are using another DNS provider, you can follow the same steps to create a CNAME record in your DNS provider. Go to your Route53 hosted zone and click on Create Record Set. Then add below details to create a CNAME record.
Now we can deploy a demo application to test our Ngix Ingress Controller. Here I am going to deploy 2048 Games as a Demo App. Create a file called `2048.yaml` and add below content to that file.
Now we can deploy this application by running below command.
1
kubectl apply -f 2048.yaml -n 2048-game
It’ll take some time to propagate the DNS changes. After that, you can access the 2048 Games application by using the URL http://2048.domain.com. You can now see the 2048 Games application is working fine but the URL is not secure. So we need to add SSL to our application. To do that we need to install Cert-Manager.
Install Cert-Manager
In here we are going to use `Cert-Manager` to add SSL to our application. So first we need to install Cert-Manager. To do that run below command.
Now you can apply this ingress by running below command.
1
kubectl apply -f 2048.yaml -n 2048-game
Now you can see the SSL certificate is added to the 2048.domain.com. You can check that by going to the browser and accessing the 2048 Games application by using the URL https://2048.domain.com.
Conclusion
In this article, we learned how to install Ngix Ingress Controller in EKS with enabled SSL. I hope you enjoyed this article. If you have any issue regarding this tutorial, mention your issue in the comment section or reach me through my E-mail.