-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: admission webhook "validate.nginx.ingress.kubernetes.io" denied the request: host "xyz" and path "/" is already defined in ingress xxx #8216
Comments
@dev-samples: This issue is currently awaiting triage. If Ingress contributors determines this is a relevant issue, they will accept it by applying the The 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. |
Its not in the ingress api spec to implement controllers that can service 2 ingress objects with identical host & path. Imagine the practical consequences of that. However another person seemed to have faced this same requirement https://kubernetes.slack.com/archives/CANQGM8BA/p1616518953121800 /remove-kind bug |
Yes as I mentioned I need this for a temporary workaround and not a permanent configuration. Also it seems strange that it works fine for 1.15 so I was also wondering if I was missing some configuration option that allows for this. Update. Ok the slack thread you link to goes into more depth with this, thanks! So seems the nginx admission controller has become more strict since 1.15. Will try and wrap my head around this details in that (long) slack thread :-) |
We have a genuine use case for this to work. We have two ingress-nginx instances, one for traffic from external sources, and one for traffic from internal sources. We want to use an internal ingress to route traffic the the internal ingress-nginx, and the external ingress to route traffic to the external-nginx. There is no conflict or ambiguity. The IP routing makes sure that the traffic goes to the correct instance. But as of the latest ingress-nginx it seems that this working setup is no longer working. As the two ingress objects conflict with each other despite having two different classes. I consider this a regression and as a result a bug. |
Also while good somebody posted a link to a workaround, would be good if somebody could paste the gist here, as not everybody is subscribed to that slack channel... My guess is that the workaround is to disable the webhook, i.e. set controller.admissionWebhooks.enabled=false |
Probably duplicate of #7546. |
Whoever comes here from google search disabling admission webhook in controlled didn't help me, but |
This behaviour conflicts with the documentation:
|
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
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. |
I was wrong. |
/reopen |
/remove-lifecycle rotten |
@pawellrus: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
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. |
/reopen |
@brianmay: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
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. |
I'm getting the same issue. I have same scenario that @brianmay described (one ingress class for internal and another for external traffic) and I got the same error: Error from server (BadRequest): error when creating "spec/ingress/nginx-ingress.yml": admission webhook "validate.nginx.ingress.kubernetes.io" denied the request: host "foo" and path "bar" is already defined in ingress namespace/ingress-name Anyway to workaround this problem? I'm using ingress-nginx version 1.3.1 |
/reopen |
@mesquitamv: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
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. |
@mesquitamv I have a vague recollection I disabled the admission web hook. It isn't needed, it just does some sanity checks. Which it appears are a bit broken. Looking at the helm chart, I think you can disable the hooks by setting We are now using skipper, that does not have this particular problem. Unfortunately, since this bug was auto closed, I don't think we are getting the attention of the developers. Might need to open a new bug report, since we can't reopen this one. But I would suggest looking for an alternative ingress implementation, maybe one that is better supported. |
|
/reopen Recently, I have seen some other feedback as well. #10318 |
@tao12345666333: Reopened this issue. In response to this:
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. |
About the admission webhooks response.As you can see, sometimes you may see the following response.
We have implemented some logical checks in the admission webhook to assist us with data validation. You will receive this response here for the following reasons:
How to solve it
Not finished yet, I will come back when I have time. |
I can add my thoughts here as well, so that the details aren't spread across multiple issues. Use case: "Renaming" an ingress objectMy specific use case is attempting to "rename" an ingress, because we only needed one at first, but now I'd like to have two ingresses. So I'd like to add a new ingress and rename the old one, so that the names make sense. This has been reported to Helm in the issue helm/helm#12157, but I don't think the fault here is with Helm. Since there is no such thing as renaming an object in Kubernetes, you need to:
The admission webhook does not allow the intermediate state between step 1 and step 2, where there would be two ingresses targeting the same hostname and path. Helm does the exact same thing that I would have done, if I had been tasked with doing this manually, as far as I can tell. I included steps for how to reproduce this in #10318. Why not delete first?Going the other way around would not run into the same problem:
The reason this is not an acceptable workaround for everyone is that it would make the application unavailable between step 1 and step 2, where there would be no ingress targeting example.com. A quick search on the Internet turns up a lot of answers telling me to delete the admission webhook policy, as you mention @tao12345666333. That would be unfortunate for a shared cluster like the one I'm using at work (and I don't think the cluster admins would allow it). Thoughts about possible solutionsIf Kubernetes had supported renaming objects or multi resource transactions (kubernetes/client-go#630) then this would not have been a problem. But Kubernetes does not support that, so I think ingress-nginx should provide some way to allow the transient state between creating a new ingress object and deleting the old one. Some ideas:
I'm looking forward to seeing your full answer, tao 🙂 |
@tobinus note that @dud225 pointed out earlier in the discussion, the currently documented behavior is "If the same path for the same host is defined in more than one Ingress, the oldest rule wins", so your suggestion of "handle duplicate ingresses in a deterministic manner" is actually already implemented. The situation is already handled gracefully, it's just prevented from occurring by the admission webhook. In addition to it being the one already implemented I think, your suggestion of "handle duplicate ingresses in a deterministic manner" is the best option, since it allows for broader use cases than just "rename existing ingresses", but zero-downtime replacement of ingresses in general. This is useful for helm upgrades, where a template could be modified to change both the naming scheme and the configuration of an ingress at the same time (or different times, which then get compressed into one time by a user jumping multiple versions in a single upgrade). I understand the reasoning of wanting to avoid potential confusion caused by multiple Ingress objects matching a single route, but to me this is a case of trying to mitigate a surface-level confusing behavior leading to more deeply confusing behavior down the road. |
We are also seeing this surprising behaviour from the admission webhook. It's surprising to us because without the ability to use the existing behaviour, cosmetically re-naming Ingress resources triggers downtime. Are there no work-arounds other than disabling all webhook validation? |
no, there is no well-known and supported method for that. |
Can the admission webhook select what it should validate? I have two nginx ingress controller instances, and it seems there is only 1 admission webhook for both instances to validate all my ingress resources. This is confusing and challenging. We really want to install some standby load balancer/ingress with the same name on the cluster. |
Afaik this has been fixed for several months at least. |
hi @jsalatiel , how is the fix and in which version? I've tried the latest helm-chart and it seems the problem still persists. The controller version is 1.9.4
|
My bad. I can confirm that is fixed. You need to change the
|
Exactly. |
This ticket should be closed by the author |
/close |
@longwuyuan: Closing this issue. In response to this:
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. |
Confused as to why this is closed without any change to documentation or implementation.
We'd prefer the validating webhook did not mark duplicate host/path as invalid (since it is valid). Probably an argument to the webhook could make that user-configurable. |
This issue was about not being able to have the same path/host in different ingress controllers deploys/instances. It has been a regression created after the ingressClassName adoption. |
OK, I see that in the comments, but overlooked that in the Ingress resources as they have no So is it not considered a bug that the same host/path is not permitted in the same ingress controller despite the docs?
|
Imho that's expected. |
Opened this issue #10820 to further discuss purposeful ambiguous hostnames with the same ingress class. |
I recently upgraded to k8s 1.22.4 and ingress-nginx version 4.0.16 and now its no longer possible to create two different ingress objects with the same host/path pointing to two different services (which need I need for a temporary workaround).
This worked fine in k8s 1.15 with e.g. something like this:
But in 1.22.4 with:
I get the error:
Error: admission webhook "validate.nginx.ingress.kubernetes.io" denied the request: host "xyz" and path "/" is already defined in ingress xxx
Is there some document/changelog describing this specific change or some option I can temporary set to allow for multiple ingresses to be created with same host/paths?
The text was updated successfully, but these errors were encountered: