<p>I have 5 microservices which I wish to allow external traffic to. These microservices will be hosted on different subdomains. I am using K8s cluster on EKS and have the cluster and other services running.
There seems to be quite a lot of confusion when it comes to Ingress. I have configured the ALB ingress controller by following this tutorial on <a href="https://www.eksworkshop.com/beginner/130_exposing-service/ingress_controller_alb/" rel="nofollow noreferrer">eksworkshop</a>. This worked for me and I am able to deploy the 2048 game as the tutorial explains.</p>
<p>Now what I wish to develop is an Ingress resource as following:</p>
<pre><code># apiVersion: networking.k8s.io/v1beta1
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
    name: cluster-ingress
    annotations:
        kubernetes.io/ingress.class: alb
        alb.ingress.kubernetes.io/scheme: internet-facing
        alb.ingress.kubernetes.io/target-type: ip
spec:
    rules:
        - host: app.my-domain.com
          http:
              paths:
                  - path: /*
                    backend:
                        serviceName: app-cluster-ip-service
                        servicePort: 3000

        - host: ms1.my-domain.com
          http:
              paths:
                  - path: /*
                    backend:
                        serviceName: ms1-cluster-ip-service
                        servicePort: 8000
        - host: ms2.my-domain.com
          http:
              paths:
                  - path: /*
                    backend:
                        serviceName: ms2-cluster-ip-service
                        servicePort: 2000
        - host: ms3.my-domain.com
          http:
              paths:
                  - path: /*
                    backend:
                        serviceName: ms3-cluster-ip-service
                        servicePort: 4000
        - host: website.my-domain.com
          http:
              paths:
                  - path: /*
                    backend:
                        serviceName: website-cluster-ip-service
                        servicePort: 3333
</code></pre>
<h1><strong>So here are my doubts</strong></h1>
<ol>
<li>How do I configure ingress to redirect to different ports based on the domain? (when I was using Nginx, there is a provision to set Upstream and then Nginx routes traffic accordingly)</li>
<li>What is the procedure to link it to my registered domain? (TLS certificates with Cert manager Lets Encrypt)</li>
<li>What should I put in my DNS records for all the subdomains? (A records/CNAME of ALB) And do all the 5 subdomains have the same record/config?</li>
</ol>
<p>I use Cloudflare for DNS management if that helps.</p>

<ol>
<li>Application load balancer uses the rules to conditional route the requests to different hosts/paths. So <a href="https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/" rel="nofollow noreferrer">AWS load balancer controller</a> supports that feature via annotations, see <a href="https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/ingress/annotations/#traffic-routing" rel="nofollow noreferrer">doc</a> for detail.</li>
<li>You can cert manager to manage the certificates of your domain. Also AWS load balancer supports <a href="https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/ingress/annotations/#ssl" rel="nofollow noreferrer">specifying the certificate stored in ACM</a> if you use a wildcard cert.</li>
<li>Yes, you have to create multiple DNS records for your domains whatever the ingress controller you’re using. You can have a look at <a href="https://github.com/kubernetes-sigs/external-dns" rel="nofollow noreferrer">external-dns</a> to make it automatically.</li>
</ol>
