-
Notifications
You must be signed in to change notification settings - Fork 3.4k
cilium-cli: enable websockets for k8s exec #37538
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
Conversation
bb772d4
to
e2a5972
Compare
/test |
As an aside, this will also reduce the likelihood of #31067 by quite a bit 🫶 |
e2a5972
to
db0e00e
Compare
Users of Cilium have begun to report that the `cilium sysdump` command encounters errors with the following form: error with exec request ... : Upgrade request required: "" Kubernetes v1.31 made Websocket the default streaming protocol for use by kubectl[1]. As described in KEP-4006[2], the prior protocol in use, SPDY, has been deprecated since 2015, and is no longer supported by many proxies, gateways and loadbalancers. Such proxies will result in clients observing errors like the above in cases where SPDY is not supported. This PR changes the streaming protocol used by the Cilium CLI for commands such as `cilium sysdump`, to use the new Websocket executor supported by client-go. It makes use of the fallback mechanism provided by the apimachinery package, to fallback to SPDY in the case that common protocol errors are observed. [1]: https://kubernetes.io/blog/2024/08/20/websockets-transition/ [2]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/4006-transition-spdy-to-websockets Signed-off-by: Andrew Sauber <andrew.sauber@isovalent.com>
db0e00e
to
2b00ca4
Compare
Users of Cilium have reported that the `cilium sysdump` command encounters errors with the following form: failed to collect ...: Upgrade request required As part of KEP-4006, a protocol translator proxy was implemented to allow websocket-based connections to the kube-apiserver by kubectl to be translated to SPDY-based connections to the kubelet by the kube-apiserver, for the sake of features like kubectl port-forward. In the case of either protocol for the backend-leg connection, we prefer to use the websocket-based client connection to avoid errors like the above. This PR uses a fallback mechanism which was implemented in the apimachinery package to support implementations in upgrading to websocket clients, which was made default in Kubernetes 1.31. [1]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/4006-transition-spdy-to-websockets [2]: kubernetes/kubernetes#119186 Signed-off-by: Andrew Sauber <andrew.sauber@isovalent.com>
2b00ca4
to
88089dd
Compare
/test |
This is hitting #37682 |
@julianwiedmann Yes, I traced the upstream websocket implementation, which has a hardcoded timeout after seeing no writes for 60 seconds. Since we switched to tcpdump writing to a file rather than stdout, the |
Users of Cilium have begun to report that the
cilium sysdump
command encounters errors with the following form:Kubernetes v1.31 made Websocket the default streaming protocol for use by kubectl1. As described in KEP-40062, the prior protocol in use, SPDY, has been deprecated since 2015, and is no longer supported by many proxies, gateways and loadbalancers. Such proxies will result in clients observing errors like the above in cases where SPDY is not supported.
This PR changes the streaming protocol used by the Cilium CLI for commands such as
cilium sysdump
, to use the new Websocket executor supported by client-go.It makes use of the fallback mechanism provided by the apimachinery package, to fallback to SPDY in the case that common protocol errors are observed.