Aws-load-balancer-controller: paths not working

Created on 28 Oct 2018  路  12Comments  路  Source: kubernetes-sigs/aws-load-balancer-controller

Hi I have setup ingress-controller on AWS EKS, but I am having problems resolving paths other then the base /

In the example below / does work correctly however /api does not work.

I am using the same app in this example but I have tested it with other apps running in my cluster aswell, all which dont work on /somethinghere.

Any idea what might be going wrong ?

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "webapp-alb-ingress"
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/subnets: subnet-01e193631sfedsf0a3,subnet-0b0064f88sdffd075,subnet-0252d90sdffdfb77e
    alb.ingress.kubernetes.io/tags: Environment=prod,Team=locali
    ingress.kubernetes.io/rewrite-target: /
  labels:
    app: webapp-service
spec:
  backend:
    serviceName: default-http-backend
    servicePort: 80
  rules:
  - http:
      paths: 
        - backend:
            serviceName: localiapi
            servicePort: 4040
          path: /api
        - backend:
            serviceName: localiapi
            servicePort: 4040
          path: /
lifecyclrotten

Most helpful comment

Hi,

have the same problem, It would be nice if we had a rewrite target rule for the alb like it's possible with the nginx ingress controller.

BR

All 12 comments

I had the same problem, solution is to use path: /*. Because the rule for the ALB is referencing this value directly, e.g.:

screenshot 2018-10-29 at 14 26 31

So if the rule says "Path is /", then all your requests (other than for /) return a 404 (fallback rule).

Thanks for the quick reply. Unfortunately this does not fix my case :(

When I look at the rules on the ALB they look like this:

screenshot 2018-10-29 at 15 15 25

Which seems correct to me. Both paths should direct to the same app.
However when I go to /api, I get a 404 returned by the app (not the default-backend).

screenshot 2018-10-29 at 15 20 46

Does your service respond on /api? The ALB does not do URL rewrites and therefor the service needs to respond on the same paths being requested on the ALB.

@bigkraig Aha! that makes sense... I did not take this into account. I am very new to Kubernetes, so thanks for pointing that out.

NP, definitely not what most people expect and it would be nice if we could provide a rewrite rule in the ALB. You may also want to change your rule to use /api* and ditch the /* rule.

I have the same issue. Simply put I have a site and i have created an ALB like:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: identity-manager
namespace: default
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/tags: app=node,tier=backend
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:eu-central-1:7yyyyyy:certificate/xxxx
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}, {"HTTP": 8080}, {"HTTPS": 8443}]'
alb.ingress.kubernetes.io/ip-address-type: ipv4
alb.ingress.kubernetes.io/backend-protocol: HTTP
alb.ingress.kubernetes.io/subnets: subnet-0e0b2522292ac20f8,subnet-0957a17b6e8e63294,subnet-040d1fc58359f8151
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
spec:
rules:
- host: identity-manager.cloud.serra.pw
http:
paths:
- path: /api
backend:
serviceName: node
servicePort: 80

So with this

identity-manager.cloud.serra.pw/api/ works but anything underneath does not work so I need to edit

      - path: /api
        backend:
          serviceName: node
          servicePort: 80

to

      - path: /api/*
        backend:
          serviceName: node
          servicePort: 80

Then it works. Other Ingress simply works with /api only. So aws-alb-ingress-controller must match to this behaviour I think.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

Hi,

have the same problem, It would be nice if we had a rewrite target rule for the alb like it's possible with the nginx ingress controller.

BR

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@vjsairam: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joseppla picture joseppla  路  5Comments

benwilson512 picture benwilson512  路  5Comments

NickEAVE picture NickEAVE  路  3Comments

rdubya16 picture rdubya16  路  4Comments

khacminh picture khacminh  路  3Comments