-
Notifications
You must be signed in to change notification settings - Fork 39.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
Webhook ServiceReference is not resolved to cluster IP #72936
Comments
@kubernetes/sig-api-machinery-bugs (I think) |
@khogeland: Reiterating the mentions to trigger a notification: 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. |
is this reproducible with 1.11+? https://github.com/liggitt/kubernetes/blob/master/staging/src/k8s.io/kube-aggregator/pkg/apiserver/resolvers.go#L49-L63 is the implementation that resolves to cluster IPs |
That resolver is also present in 1.9, so I assume so, unless the API server is configured differently? I'll try to repro this on 1.13. |
Cool, looks like this has been fixed since 1.9! I guess the wiring did change. 1.9.7
1.13.2
|
What happened: Creating a
MutatingWebhookConfiguration
withservice
set andcaBundle
unset caused the API server to send a request tomyservice.default.svc
, which fails to resolve, as the API server cannot talk to KubeDNS.What you expected to happen: The API server should have resolved the service reference to the service's cluster IP, and used that in the HTTP request.
Workaround for anyone with the same issue: weirdly, setting
caBundle
causes the webhook to work - in this case it looks like the API server is properly resolving the service reference to a cluster IP and not attempting to use DNS. You can verify by pointing a webhook config to a non-existent service and observing the "Service not found" error. Happy accident?How to reproduce it (as minimally and precisely as possible):
Using a k8s setup where the API server can't talk to KubeDNS (i.e. running on bare metal with no special resolv.conf):
MutatingWebhookConfiguration
with thecaBundle
field unset/empty and theservice
field set<something>.<namespace>.svc
Anything else we need to know?:
As stated in
WebhookClientConfig
, the API server is not expected to be able to resolve in-cluster service names. However, the default (and only?) ServiceResolver implementation simply returns the in-cluster service hostname. This seems like the root issue; this implementation is bogus, there should instead be an implementation that resolves the ServiceReference into a cluster IP.The fact that it works with the
caBundle
field looks coincidental/accidental, but is interesting. I couldn't figure out where the difference in behavior was coming from. 🙂Environment:
kubectl version
): 1.9.7The text was updated successfully, but these errors were encountered: