Kubernetes Blog
Follow
Kubernetes 1.31: Streaming Transitions from SPDY to WebSockets
In Kubernetes 1.31, kubectl now uses WebSocket instead of SPDY for streaming APIs. This change improves compatibility with proxies and load balancers.Streaming APIs provide real-time, bi-directional communication between clients and servers. They are used in commands like kubectl exec, cp, attach, and port-forward.Before v1.31, Kubernetes used the deprecated SPDY/3.1 protocol for streaming. This caused issues with modern proxies and gateways.WebSocket is a standardized streaming protocol that is widely supported.Kubernetes upgrades HTTP connections to streaming by adding upgrade headers to HTTP requests.The server responds with a successful status and the negotiated subprotocol version.TCP connections then transition to streaming for subsequent data exchange.Kubernetes 1.31 has beta feature gates and kubectl environment variables to control the use of WebSockets.Older clusters require explicit feature gate settings to use WebSockets.Kubectl 1.31 can automatically use WebSockets with clusters that have server-side features enabled.More information on streaming APIs is available in Kubernetes Enhancement Proposal 4006, RFC 6455, and the Container Runtime Interface streaming documentation.