ingress-nginx: ingress-nginx 4.4.3 adds duplicated location block
What happened:
generated nginx config adds location /
blocks for some cases twice, config does not pass validation and ingress stucks in crash loop. It found this only for 2 domains (ingresses), one of them have basic auth and letsencrypt tls, and the other just letsencrypt (most basic setup), other similar ingresses were not affected
Reverting to 4.4.2 resolves issue
Error: exit status 1
2023/02/01 19:49:45 [warn] 34#34: the "http2_max_field_size" directive is obsolete, use the "large_client_header_buffers" directive instead in /tmp/nginx/nginx-cfg587039469:144
nginx: [warn] the "http2_max_field_size" directive is obsolete, use the "large_client_header_buffers" directive instead in /tmp/nginx/nginx-cfg587039469:144
2023/02/01 19:49:45 [warn] 34#34: the "http2_max_header_size" directive is obsolete, use the "large_client_header_buffers" directive instead in /tmp/nginx/nginx-cfg587039469:145
nginx: [warn] the "http2_max_header_size" directive is obsolete, use the "large_client_header_buffers" directive instead in /tmp/nginx/nginx-cfg587039469:145
2023/02/01 19:49:45 [warn] 34#34: the "http2_max_requests" directive is obsolete, use the "keepalive_requests" directive instead in /tmp/nginx/nginx-cfg587039469:146
nginx: [warn] the "http2_max_requests" directive is obsolete, use the "keepalive_requests" directive instead in /tmp/nginx/nginx-cfg587039469:146
2023/02/01 19:49:45 [warn] 34#34: could not build optimal proxy_headers_hash, you should increase either proxy_headers_hash_max_size: 512 or proxy_headers_hash_bucket_size: 64; ignoring proxy_headers_hash_bucket_size
nginx: [warn] could not build optimal proxy_headers_hash, you should increase either proxy_headers_hash_max_size: 512 or proxy_headers_hash_bucket_size: 64; ignoring proxy_headers_hash_bucket_size
2023/02/01 19:49:45 [emerg] 34#34: duplicate location "/" in /tmp/nginx/nginx-cfg587039469:851
nginx: [emerg] duplicate location "/" in /tmp/nginx/nginx-cfg587039469:851
nginx: configuration file /tmp/nginx/nginx-cfg587039469 test failed
What you expected to happen: It should not crash
NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):
NGINX Ingress controller
Release: v1.6.1
Build: 1bf5317969fd0c91e11added92aa649ba68fd64d
Repository: https://github.com/kubernetes/ingress-nginx
nginx version: nginx/1.21.
Kubernetes version (use kubectl version
):
Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.0", GitCommit:"b46a3f887ca979b1a5d14fd39cb1af43e7e5d12d", GitTreeState:"clean", BuildDate:"2022-12-08T19:51:45Z", GoVersion:"go1.19.4", Compiler:"gc", Platform:"linux/amd64"}
Environment:
- How was the ingress-nginx-controller installed:
- If helm was used then please show output of
helm ls -A | grep -i ingress
- If helm was used then please show output of
helm -n <ingresscontrollernamepspace> get values <helmreleasename>
- If helm was not used, then copy/paste the complete precise command used to install the controller, along with the flags and options used
- if you have more than one instance of the ingress-nginx-controller installed in the same cluster, please provide details for all the instances
- If helm was used then please show output of
ingress-nginx ingress-nginx 9 2023-02-01 19:45:33.6887662 +0000 UTC deployed ingress-nginx-4.4.3 1.6.1
values
controller:
metrics:
enabled: false
hostNetwork: true
hostPort:
enabled: true
watchIngressWithoutClass: true
kind: DaemonSet
service:
external:
enabled: false
admissionWebhooks:
timeoutSeconds: 30
config:
bind-address: <...>
tcp: <...>
udp: <...>
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 53
- Comments: 63 (30 by maintainers)
Links to this issue
Commits related to this issue
- Revert "fix(helm): update helm release ingress-nginx to v4.4.3" This reverts commit 305bef4e3cfda9a62f2ad1f6056bf88f435ec30e. Upstream issue: https://github.com/kubernetes/ingress-nginx/issues/9569 — committed to samip5/k8s-cluster by samip5 a year ago
- Revert "fix(helm): update chart ingress-nginx to 4.4.3 (#1619)" This reverts commit 5a7ac8518477a97aff13969e044d2c40f99114ee. helm chart 4.4.3 fails with "duplicate location /" errors. https://github... — committed to haraldkoch/kochhaus-home by haraldkoch a year ago
- build 1.6.2 to fix #9569 Signed-off-by: James Strong <james.strong@chainguard.dev> — committed to strongjz/ingress-nginx by strongjz a year ago
- Renovate: ingress-nginx lost auto merge privileges Ref: kubernetes/ingress-nginx#9569 — committed to samip5/k8s-cluster by samip5 a year ago
- remove 4.4.3 Helm chart ref: https://github.com/kubernetes/ingress-nginx/issues/9569 Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com> — committed to tao12345666333/ingress-nginx by tao12345666333 a year ago
- remove 4.4.3 Helm chart ref: https://github.com/kubernetes/ingress-nginx/issues/9569 Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com> — committed to kubernetes/ingress-nginx by tao12345666333 a year ago
- build 1.6.2 to fix #9569 Signed-off-by: James Strong <james.strong@chainguard.dev> — committed to strongjz/ingress-nginx by strongjz a year ago
- build 1.6.2 to fix #9569 Signed-off-by: James Strong <james.strong@chainguard.dev> — committed to strongjz/ingress-nginx by strongjz a year ago
- build 1.6.2 to fix #9569 Signed-off-by: James Strong <james.strong@chainguard.dev> — committed to strongjz/ingress-nginx by strongjz a year ago
- build 1.6.2 to fix #9569 Signed-off-by: James Strong <james.strong@chainguard.dev> — committed to cpanato/ingress-nginx by strongjz a year ago
- build 1.6.2 to fix #9569 Signed-off-by: James Strong <james.strong@chainguard.dev> — committed to strongjz/ingress-nginx by strongjz a year ago
- build 1.6.2 to fix #9569 Signed-off-by: James Strong <james.strong@chainguard.dev> — committed to cpanato/ingress-nginx by strongjz a year ago
- build 1.6.2 to fix #9569 Signed-off-by: James Strong <james.strong@chainguard.dev> — committed to cpanato/ingress-nginx by strongjz a year ago
- build 1.6.2 to fix #9569 Signed-off-by: James Strong <james.strong@chainguard.dev> — committed to strongjz/ingress-nginx by strongjz a year ago
- build 1.6.2 to fix (#9569) — committed to strongjz/ingress-nginx by strongjz a year ago
- build 1.6.2 to fix (#9569) — committed to strongjz/ingress-nginx by strongjz a year ago
- Revert "fix(helm): update chart ingress-nginx to 4.4.3 (#1619)" This reverts commit 5a7ac8518477a97aff13969e044d2c40f99114ee. helm chart 4.4.3 fails with "duplicate location /" errors. https://github... — committed to haraldkoch/kochhaus-home by haraldkoch a year ago
- build 1.6.2 to fix #9569 Signed-off-by: James Strong <james.strong@chainguard.dev> — committed to strongjz/ingress-nginx by strongjz a year ago
- build 1.6.2 to fix (#9569) — committed to strongjz/ingress-nginx by strongjz a year ago
- Revert "chore(deps): update helm release ingress-nginx to v4.4.3" This reverts commit f6a726f4e924442c431eba84180ab0ffde673f05. Broken release, upstream tracking: https://github.com/kubernetes/ingre... — committed to roobre/kustomizations by roobre a year ago
@strongjz could you please delete the faulty chart version 4.4.3 from the Helm repo index? Most Flux users have patch upgrades enabled and this broke lots of clusters.
The chart we released by accident and was not ready for consumption; please pin your charts to 4.4.2. I apologize for this confusion and the issues this caused. The CI was updated to add linting and testing before a release/push to the main branch. And I agree the ingress-controller version was bumped to 1.6.1 but only a minor on the chart.
The implementation-specific changes should also have the path validation boolean on them.
Please don’t release this as a minor chart update
It looks like you are correct Both my broken ingress classes had
pathType: ImplementationSpecific
and changing it toPrefix
resolved the issueSame happened to me. My helm values are here.
just in case somebody else needs it - here’s how to override prefix type for kubernetes-dashboard chart:
1.6.2 is building, once its completed, we move it to production k8s registry then we can release a new controller and chart
I have three ingress classes (all nginx ingresses) on my home lab cluster, only one was impacted by this.
We’re going to remove path validation, I’ve tested both
https://github.com/kubernetes/ingress-nginx/pull/9543
https://github.com/kubernetes/ingress-nginx/pull/9511
They both cause a duplicate / location error. We will have to investigate why it does this before releasing it.
After talking with @tao12345666333 and @rikatz 1.6.3 will be CVE fixes and other changes.
Thank you for testing and your patience while we release and secure ingress-nginx.
in my case it was
Longhorn at least seems to be using
ImplementationSpecific
in the UI ingress.TLDR: only ingresses with ImplementationSpecific type were affected.
I have two controllers and classes: public and private (eks and alb controller).
So only few of private ingresses were set following:
And all public had type Prefix. As a result of chart auto update (which I guess I really do need to disable) - public controller updated just fine but private failed to update because new pod went into crash loop with error described in this ticket. Fix was to manually change all ingresses to Prefix and restart pod and update again.
Haven’t tested though what would happen if path was set to smth like /* - I believe that’s the intended usage and valid case for ImplementationSpecific?
Thank you for confirming and working on remediations. #HugOps
@tao12345666333 sure, here you go https://gist.github.com/tamcore/8492603891febe562d72ca57c162e944
1.5.0 would have path validation enabled by default.
1.6.0 disabled it by default.
1.6.1 missing implementation-specific checks.
1.6.2 fixed that.
We can’t delete images once they are promoted in the kuberenetes registry, so our only option is to roll forward.
4.4.2 to 4.5.0 was to indicate the change and not do auto rollouts for gitops folks.
If we do a major bump of the controller we will also do a major bump of the chart. Same for minors.
I hope this clears it up.
4.4.3 is now gone? Good, the values yaml had #9579
Would anyone be able to test with v1.6.2 in the environment where the problem happens? This can also avoid subsequent issues, thank you!
https://github.com/kubernetes/ingress-nginx/pull/9575
For the convenience of testing, I have packaged the Helm chart in this PR and can download it directly. Or check out the code used in this PR.
https://drive.google.com/drive/folders/1I9m63h1B6FivCkcqQesJD0ChY5RcQpZ_?usp=share_link
already checked it, its been for the kubernetes-dashboard as @tbondarchuk said. Is the only one with ImplementationSpecific, my apologies for the confusion.
@strongjz https://gist.github.com/tbondarchuk/cc5ff7111871c0a1e2a273fb36b069b2
@ricosega your ingress are set to port name, mine to port number. perhaps issue is triggered by port.name + Prefix and by ImplementationSpecific ?
P.S. Edit: tagging correct user
This is indeed a quick fix. Many people can be prevented from being affected.
I’ll start working on it
@tbondarchuk not only ingresses with ImplementationSpecific type were affected, all mine are Prefix and also crashes as I said before.
@strongjz this is my values.yaml config
so the rest is by the default values and the controller is enabled in my case:
and here is the error log:
I faced a race condition between the admission controller and the pods that were crashing (as it wasn’t able to process the validations due to crashing pods). The error log on the crashed pods didin’t tell me what the issue is so it would be good if it also included the ingress name that’s causing it to crash.
I would have sworn up and down that I only had
Prefix
types. Alas, my affected staging cluster:Must be some odd 3rd party tool that snuck it in there 😠
EDIT: it was logstash in my case.
In my case, it was on (at least it should be as I didn’t explicitly have it disabled in the helm values). It looks like it has been out there for a while, too:
all my ingresses are like the following one:
well, I think this chart version shouldn’t have been created yet because of the many changes inside: https://github.com/kubernetes/ingress-nginx/commit/d80d4d4eca42ff9ec6ad231f187df454eec85321 version changed from 1.5.1 to 1.6.1 and more…
Affected by this as well… However all my pathTypes are set to Prefix. Going back to 4.4.2 for now.