Aws-load-balancer-controller: How do I create rule without `path-pattern` ?

Created on 22 Aug 2018  路  5Comments  路  Source: kubernetes-sigs/aws-load-balancer-controller

I thought that using this plugin, I would like to create a rule with only the host header. The definition is as follows.

spec:
  backend:
    serviceName: fallback-nginx
    servicePort: 80
  rules:
    - host: myapp1.example.com
      http:
        paths:
          - backend:
              serviceName: myapp1
              servicePort: 80

However, path-pattern '/' is automatically added. I want to exclude the path-pattern from the rule, is it possible?

$ aws elbv2 describe-rules  --rule-arns arn:aws:elasticloadbalancing:us-west-2:xxxxxx:listener-rule/app/xxxxxx
{
    "Rules": [
        {
            "RuleArn": "arn:aws:elasticloadbalancing:us-west-2:xxxxxx:listener-rule/app/xxxxxx",
            "Priority": "1",
            "Conditions": [
                {
                    "Field": "path-pattern",
                    "Values": [
                        "/"
                    ]
                },
                {
                    "Field": "host-header",
                    "Values": [
                        "myapp1.example.com"
                    ]
                }
            ],
            "Actions": [
                {
                    "Type": "forward",
                    "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:xxxxxx:listener-rule/app/xxxxxx"
                }
            ],
            "IsDefault": false
        }
    ]
}
kinquestion

Most helpful comment

I am also being affected by this issue. It appears this bug was introduced in #476 (first released as 1.0-beta.5) in this repo; kubernetes/ingress-nginx#2244 introduced the behavior for the nginx ingress controller, which works for nginx because the paths in nginx are prefixes, not exact matches or globs.

I can verify that path-less rules work in version 1.0-alpha.9, and I have reverted to that version to resolve the issue.

All 5 comments

It's not possible, the ALB requires that a rule matches a path. Does this create an issue or is it just unexpected?

https://docs.aws.amazon.com/ja_jp/elasticloadbalancing/latest/APIReference/API_RuleCondition.html

ALB allows host-header only rule, path-pattern could omitted.

for example

ec2 management console 2018-09-06 02-56-03

Current situation If we want to use host name based routing using this plugin, we need to set /* to path-pattern for all. This means that we can only use half the maximum number of if matches.

I am also being affected by this issue. It appears this bug was introduced in #476 (first released as 1.0-beta.5) in this repo; kubernetes/ingress-nginx#2244 introduced the behavior for the nginx ingress controller, which works for nginx because the paths in nginx are prefixes, not exact matches or globs.

I can verify that path-less rules work in version 1.0-alpha.9, and I have reverted to that version to resolve the issue.

yeah totally a bug, was just fixed in #670

@bigkraig

The problem close to Issue was reviving.
I think that it is probably the following commit, "/*" is automatically added to it.

https://github.com/kubernetes-sigs/aws-alb-ingress-controller/commit/9d354b8293db244706d3cfeb575ddb0d803e610d

If there is no path-pattern or if "/ *" is specified for path-pattern, both actions are the same, but the upper limit (100) of the number of rules applicable to ALB has been affected. By specifying "/ *" automatically, host-based rules can only be created up to 50.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jwickens picture jwickens  路  4Comments

joseppla picture joseppla  路  5Comments

madhu131313 picture madhu131313  路  3Comments

jcderr picture jcderr  路  3Comments

khacminh picture khacminh  路  3Comments