3

I have a simple task, but it is not solved even after studying dozens of articles.

There is a simple AWS EKS cluster created from a demo template using eksctl, ElasticIP and installed without changes https://bitnami.com/stack/nginx-ingress-controller/helm

There is a domain https://stage.mydomain.com which I want to forward to ElasticIP, using DNS A-record, on AWS EKS nginx ingress controller 1234567890.eu-central-1.elb.amazonaws.com so that all the services of my cluster are available at this ElasticIP address.

I tried through Load Balancer and Network Balancer, but it doesn't work.

Is there a proven article or sequence of actions for solving this problem and with this set of services?

stackuser
  • 61
  • 4
  • Yes this issues do come, even if you follow the tutorials. Because there has been changes in load balancer. Please follow this tutorial : https://www.eksworkshop.com. This worked for me, for both EC2 and Fargate deployments – Mehavel Jul 12 '21 at 03:17

1 Answers1

1

Yes that's common in AWS articles also NLD value coming like this way only

https://aws.amazon.com/blogs/opensource/network-load-balancer-nginx-ingress-controller-eks/

In the above article installing the NGINX controller using the NLB as backend which providing the IP the same way.

In this case you can add the DNS with A or CNAME

Once your ingress controller setup is done you will get LB endpoint you have to add this to DNS as A record or CNAME

this will forward the request to the cluster.

Now inside the cluster, you have to create the ingress using applying the YAML

https://kubernetes.io/docs/concepts/services-networking/ingress/

ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /testpath
        pathType: Prefix
        backend:
          service:
            name: test
            port:
              number: 80

For NLB in you can add the annotation to service

**service.beta.kubernetes.io/aws-load-balancer-type: nlb**


apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
    service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: '60'
    service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: 'true'
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
  labels:
    helm.sh/chart: ingress-nginx-2.0.3
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/version: 0.32.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: controller
  name: ingress-nginx-controller
  namespace: ingress-nginx
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: http
    - name: https
      port: 443
      protocol: TCP
      targetPort: https
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/component: controller
Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
  • Thanks for the article, I checked it out as well. Unfortunately it does not answer the question, how do I use AWS ElasticIP so that the stage.domain.com domain, which is not registered with AWS and has an A-record specified with this AWS ElasticIP, is the cluster entry point for all services in my cluster? What configuration parameters are required by NLB and nginx-ingress? – stackuser Jul 12 '21 at 10:52