Skip to content

[Bug]: cnpg status command to display database size is unable to upgrade connection #10873

Closed

Description

@bartscheers

Is there an existing issue already for this bug?

  • 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.

Cluster resource

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. dosubot commented on Jun 11, 2026

    @dosubot

    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+.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about cloudnative-pg with Dosu Add Dosu to your team

  2. added a commit that references this issue on Jun 16, 2026
    8edf116
  3. added a commit that references this issue on Jun 16, 2026
    dc3e279
  4. added
    bug 🐛Something isn't working
    and removed on Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug 🐛Something isn't workingtriagePending triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions