Skip to content

kubectl version seems broken since 579 #657

Description

@albanpeignier

Issue Description

The kubectl version returns strange values: major and minor attributes are empty. gitVersion and gitCommit contain like raw patterns.

kubectl version --client --output=json
{
  "clientVersion": {
    "major": "",
    "minor": "",
    "gitVersion": "v0.0.0-master+$Format:%H$",
    "gitCommit": "$Format:%H$",
    "gitTreeState": "",
    "buildDate": "2026-07-22T17:11:40Z",
    "goVersion": "go1.26.5",
    "compiler": "gc",
    "platform": "linux/amd64"
  },
  "kustomizeVersion": "v5.7.1"
}

Expected Behavior

By using the latest kubectl binary, the output seems normal:

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
./kubectl version --client --output=json
{
  "clientVersion": {
    "major": "1",
    "minor": "36",
    "gitVersion": "v1.36.3",
    "gitCommit": "0f29094e5b73085e3802ecc1298ecae13866bfe6",
    "gitTreeState": "clean",
    "buildDate": "2026-07-22T18:10:35Z",
    "goVersion": "go1.26.5",
    "compiler": "gc",
    "platform": "linux/amd64"
  },
  "kustomizeVersion": "v5.8.1"
}

Steps to Reproduce

Use google/cloud-sdk:579 or google/cloud-sdk:580 images and run kubectl version --client or kubectl version --client --output=json:

docker run --rm -it google/cloud-sdk:579.0.0-slim sh -c "apt install -y kubectl && kubectl version --client --output=json"
[...]
Setting up kubectl (1:579.0.0-0) ...
{
  "clientVersion": {
    "major": "",
    "minor": "",
    "gitVersion": "v0.0.0-master+$Format:%H$",
    "gitCommit": "$Format:%H$",
    "gitTreeState": "",
    "buildDate": "2026-07-22T17:11:40Z",
    "goVersion": "go1.26.5",
    "compiler": "gc",
    "platform": "linux/amd64"
  },
  "kustomizeVersion": "v5.7.1"
}
docker run --rm -it google/cloud-sdk:580.0.0-slim sh -c "apt install -y -q kubectl && kubectl version --client --output=json"
[...]
Setting up kubectl (1:580.0.0-0) ...
{
  "clientVersion": {
    "major": "",
    "minor": "",
    "gitVersion": "v0.0.0-master+$Format:%H$",
    "gitCommit": "$Format:%H$",
    "gitTreeState": "",
    "buildDate": "2026-07-22T17:11:40Z",
    "goVersion": "go1.26.5",
    "compiler": "gc",
    "platform": "linux/amd64"
  },
  "kustomizeVersion": "v5.7.1"
}

Workaround

Use google/cloud-sdk:578 or older (but kubectl is 1.35):

➜ docker run --rm -it google/cloud-sdk:578.0.0-slim sh -c "apt install -y -q kubectl && kubectl version --client --output=json"
[...]
Setting up kubectl (1:578.0.0-0) ...
{
  "clientVersion": {
    "major": "1",
    "minor": "35+",
    "gitVersion": "v1.35.6-dispatcher",
    "gitCommit": "09fd156955ddedeb343e16fed4068eded91114c2",
    "gitTreeState": "clean",
    "buildDate": "2026-07-08T21:21:16Z",
    "goVersion": "go1.26.4",
    "compiler": "gc",
    "platform": "linux/amd64"
  },
  "kustomizeVersion": "v5.7.1"
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions