kubernetes: integration tests log many "http: TLS handshake error from 127.0.0.1:55336: EOF" errors
What happened?
Ran
go test ./test/integration/apiserver/admissionwebhook -v -run TestWebhookAdmissionWithWatchCache
What did you expect to happen?
tests run without TLS errors
How can we reproduce it (as minimally and precisely as possible)?
Run integration tests
Anything else we need to know?
This happened on go1.17 and go1.18, so it’s not new, but indicates we either have a setup issue in our integration tests, or our logging is outputting errors in situations that should not error
Kubernetes version
$ kubectl version
# paste output here
Cloud provider
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 7
- Comments: 22 (15 by maintainers)
we are seeing this log in our operator which has a built-in webhook for conversion/validating/mutating. It seems doesn’t affect the functionalities of the webhook but it keeps appearing in log like forever. As the log shows no other info as to the source of the log we have no idea where to ask for a fix. The go version is 1.19 and kubernetes version is 1.26.3. I’d be glad to provide more information if required. Thanks!
We also see these errors a lot in cert-manager webhook logs when deployed on Kubernetes 1.23 or 1.24 when a larger number of resources are being applied that get validated by webhook.
We also see some ‘connection reset’ errors that also appear to be new in 1.23 and 1.24, not sure if those might be related:
/priority important-soon
Webhooks has a very interesting and complex setup, let me write it down for reference:
Webhooks inside the apiserver use a RESTClient to contact the webhooks, this is handled by the
ClientManagerhttps://github.com/kubernetes/kubernetes/blob/dda9bcb082be058c30c83d45e757edbaac8dc65f/staging/src/k8s.io/apiserver/pkg/util/webhook/client.go#L65-L66
conversion and validationg/mutation webhooks doesn’t use the same client manager though
The
ClientManagercaches the clients, however, the key takes the URL path into account, that means that same host will not be cached if they have different path, i.e.webhook.url/validatingv1andwebhook.url/validatingv1beta1will have a different clienthttps://github.com/kubernetes/kubernetes/blob/dda9bcb082be058c30c83d45e757edbaac8dc65f/staging/src/k8s.io/apiserver/pkg/util/webhook/client.go#L122-L124
but, interestingly, the transport is cached ONLY for webhooks using URL, because the transport is cacheable for the Client
https://github.com/kubernetes/kubernetes/blob/0765ba8e54f0c9e5f221e505a24759fa18beaf2e/staging/src/k8s.io/client-go/transport/cache.go#L136
webhooks using a Service use a custom dialer, so the transport is not cached, but (I have to verify it) the client will be cached by the
ClientManagercachehttps://github.com/kubernetes/kubernetes/blob/dda9bcb082be058c30c83d45e757edbaac8dc65f/staging/src/k8s.io/apiserver/pkg/util/webhook/client.go#L148-L168
Regarding the
http: TLS handshake error from 127.0.0.1:56638: EOFerrors, I was surprised it wasn’t happening on this test toohttps://github.com/kubernetes/kubernetes/blob/0765ba8e54f0c9e5f221e505a24759fa18beaf2e/test/integration/apiserver/admissionwebhook/load_balance_test.go#L51
but if we just remove the sleep on the webhook server
the test fails with the TLS handshake errors
based on that I think that this problem is related to
https://github.com/golang/go/issues/50984
I’ve tried different things without success, I think that the divergence between URL and Service webhooks and the multiple caching layers can be problematic in a future (if it is not a problem already 😃 )