PathBased routing AWS EKS

10/18/2021

Is path based routing allowed on AWS EKS load balancer controller.

I have been trying to setup a path based routing based on Ingress rules but I am receiving an error when I access the URL's. Here is my ingress code.

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingresscon
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/tags: Env=Dev,Billing=DevTeam
    alb.ingress.kubernetes.io/security-groups: sg-03dbe1faa37794bd2
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80},{"HTTP": 19000}]'
    alb.ingress.kubernetes.io/healthcheck-port: '80'

spec:
  rules:
    - host: example.com
      http:
        paths:
          - path: /game
            backend:
              serviceName: test2048
              servicePort: 8080
          - path: /web
            backend:
              serviceName: nginx
              servicePort: 80
          - path: /*
            backend:
              serviceName: nginx
              servicePort: 80

Accessing my url http://example.com displays nginx web page. However, if I access http://example.com/game or http://example.com/web displays an error. Am i missing anything in setting up Ingress rules?

-- nischeruku
amazon-eks
amazon-web-services
kubernetes

0 Answers