3

I am trying to implement a simple "hello world" on eks with alb Ingress controller.

My goal is to ..

  1. Create a cluster
  2. Deploy an Ingress to access using ELB

Following things have been done

  1. Created EKS cluster
  2. added "alb ingress controller"
C:\workspace\eks>kubectl get po -n kube-system
NAME                                      READY   STATUS    RESTARTS   AGE
alb-ingress-controller-5f96d7df77-mdrw2   1/1     Running   0          4m1s
  1. Created application as below
apiVersion: apps/v1
kind: Deployment
metadata:
  name: "2048-deployment"
  namespace: "2048-game"
  labels:
    app: "2048"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: "2048"
  template:
    metadata:
      labels:
        app: "2048"
    spec:
      containers:
      - image: alexwhen/docker-2048
        imagePullPolicy: Always
        name: "2048"
        ports:
        - containerPort: 80

  1. Serveice is as following
apiVersion: v1
kind: Service
metadata:
  name: "service-2048"
  namespace: "2048-game"
spec:
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP
  type: NodePort
  selector:
    app: "2048"


  1. Ingress controller is as below
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "2048-ingress"
  namespace: "2048-game"
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
  labels:
    app: 2048-ingress
spec:
  rules:
    - http:
        paths:
          - path: /*
            backend:
              serviceName: "service-2048"
              servicePort: 80

  1. output is as below, not getting Host addess as ELB .and not able to access from outside
C:\sample>kubectl get ingress/2048-ingress -n 2048-game
NAME           HOSTS   ADDRESS   PORTS   AGE
2048-ingress   *                 80      71s

Update :

Found following error in alb-ingress-controller-5f96d7df77-mdrw2 logs. Not able to find how to change

 kubebuilder/controller "msg"="Reconciler error" "error"="failed to build LoadBalancer configuration due to failed to resolve 2 qualified subnet for ALB. Subnets must contains these tags: 'kubernetes.io/cluster/ascluster': ['shared' or 'owned'] and 'kubernetes.io/role/elb': ['' or '1']. See https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/controller/config/#subnet-auto-discovery for more details. Resolved qualified subnets: '[]'"  "controller"="alb-ingress-controller" "request"={"Namespace":"default","Name":"ingress-default-dev"}
ajoy sinha
  • 1,156
  • 4
  • 14
  • 30

2 Answers2

3

If your subnets are not tagged with kubernetes.io/cluster/<cluster-name>=shared etc.... you can also try passing subnets in ingress file annotations like below

alb.ingress.kubernetes.io/subnets: subnet-xxxxxx, subnet-xxxxxx
burns0907
  • 116
  • 1
  • 9
  • Its worth mentioning that checking "describing" the ingress is beneficial and usually will show what is wrong with it. "kubectl describe ingress " – cool Dec 26 '21 at 03:28
2

The subnets where eks nodes resides should be tagged with the following

https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html#vpc-subnet-tagging

VSK
  • 359
  • 2
  • 5
  • 20