You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: cnpg status command to display database size is unable to upgrade connection #10873
I have searched for an existing issue, and could not find anything. I believe this is a new bug.
I have read the troubleshooting guide
I have read the troubleshooting guide and I think this is a new bug.
I am running a supported version of CloudNativePG
I have read the troubleshooting guide and I think this is a new bug.
Contact Details
No response
Version
1.28 (latest patch)
What version of Kubernetes are you using?
1.33
What is your Kubernetes environment?
Other
How did you install the operator?
YAML manifest
What happened?
The kubectl cnpg status -n <my-ns> <my-cluster> displays many characteristics of the cluster. However, the value of field Size reports cmd: [du -sLh /var/lib/postgresql/data/pgdata]. The latest patch version number (v1.28.3) prints error: unable to upgrade connection: empty server response as well, earlier patch version only print error: .
I would have expected to just see the database size, e.g, 320G.
Apparently, the exec still uses the deprecated SPDY protocol for streaming connections. The websocket protocol is the default since Kubernetes 1.31.
Note that in local setups using kind or minikube this will not pop up.
Hi @bartscheers! I'm Dosu and I'm helping the CloudNativePG team.
Your diagnosis is correct. The cnpg status command calculates the database size by executing du -sLh /var/lib/postgresql/data/pgdata on the primary pod [1], and it does so using remotecommand.NewSPDYExecutor()[2] — which relies exclusively on the SPDY protocol for streaming connections.
Since Kubernetes 1.31 defaulted to WebSocket for streaming and some environments/configurations may no longer support SPDY upgrades, this explains the "unable to upgrade connection: empty server response" error you're seeing.
There hasn't been a fix for this specific issue in the plugin yet. The operator's test utilities were updated to use the newer ForStreaming APIs in PR #10593[3] as part of the Kubernetes 0.36.0 dependency bump, but the kubectl plugin's ExecCommand utility in pkg/utils/exec.go still uses the legacy remotecommand.NewSPDYExecutor() path.
The fix would involve migrating the plugin's exec utility to use remotecommand.NewWebSocketExecutor() (or the combined NewSPDYExecutorReturningEncoder with WebSocket fallback) from k8s.io/client-go/tools/remotecommand, which has been available since client-go v0.29+.
Activity
dosubot commentedon Jun 11, 2026
Hi @bartscheers! I'm Dosu and I'm helping the CloudNativePG team.
Your diagnosis is correct. The
cnpg statuscommand calculates the database size by executingdu -sLh /var/lib/postgresql/data/pgdataon the primary pod [1], and it does so usingremotecommand.NewSPDYExecutor()[2] — which relies exclusively on the SPDY protocol for streaming connections.Since Kubernetes 1.31 defaulted to WebSocket for streaming and some environments/configurations may no longer support SPDY upgrades, this explains the "unable to upgrade connection: empty server response" error you're seeing.
There hasn't been a fix for this specific issue in the plugin yet. The operator's test utilities were updated to use the newer
ForStreamingAPIs in PR #10593 [3] as part of the Kubernetes 0.36.0 dependency bump, but the kubectl plugin'sExecCommandutility inpkg/utils/exec.gostill uses the legacyremotecommand.NewSPDYExecutor()path.The fix would involve migrating the plugin's exec utility to use
remotecommand.NewWebSocketExecutor()(or the combinedNewSPDYExecutorReturningEncoderwith WebSocket fallback) fromk8s.io/client-go/tools/remotecommand, which has been available since client-go v0.29+.To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
fix: use WebSocket for exec/attach streaming (#10876)
fix: use WebSocket for exec/attach streaming (#10876)