Skip to content
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

[Bug] parsing kubectl version string (upstream error: ) / "0.0.0": Version string empty #6970

Closed
boskiv opened this issue Aug 17, 2023 · 6 comments · Fixed by #7032
Closed
Assignees
Labels

Comments

@boskiv
Copy link

boskiv commented Aug 17, 2023

Config is here: https://gist.github.com/boskiv/b972e202003e2ce458e99f58cf693ba6

2023-08-17 18:59:10 [ℹ]  adding Karpenter to cluster sf-cluster
2023-08-17 19:00:27 [✖]  parsing kubectl version string  (upstream error: ) / "0.0.0": Version string empty
2023-08-17 19:00:27 [ℹ]  cluster should be functional despite missing (or misconfigured) client binaries
2023-08-17 19:00:27 [✔]  EKS cluster "sf-cluster" in "ap-northeast-1" region is ready

Versions

❯ eksctl info
eksctl version: 0.152.0-dev+078155086.2023-08-11T09:53:00Z
kubectl version: v1.28.0
OS: darwin

@TiberiuGC TiberiuGC self-assigned this Aug 18, 2023
@NatalieLow
Copy link

I'm getting the same error with the same versions of everything mentioned above. I noticed that brew updated the current version of eksctl to 0.153, so I updated, yet the error persists.

@NatalieLow
Copy link

I'm less familiar with Windows, but I attempted creating a cluster using the following settings:
kubectl version 1.28.0
eksctl version: 0.153.0
OS: Windows 10 Pro, version: 22H2, build: 19045.3324

Errors were similar:
parsing kubectl version string (upstream error: usage: aws [options] [ ...] [parameters]...
.
.
Unable to connect to the server: getting credentials: exec: executable aws failed with exit code 2
) / "0.0.0": Version string empty

@guessi
Copy link
Contributor

guessi commented Aug 19, 2023

I think the error comes from [1].

clientVersion, _, ignoredErr := kubectl.GetVersionInfo(ktl)

Here, it try to get clientVersion from [2], where you can see GetVersionInfo() will invoke kubectl version directly, but the behaviour changed after v1.28.0+.

For kubectl v1.27.4

% ./kubectl-v127 version --client 2>/dev/null
Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.4", GitCommit:"fa3d7990104d7c1f16943a67f11b154b71f6a132", GitTreeState:"clean", BuildDate:"2023-07-19T12:20:54Z", GoVersion:"go1.20.6", Compiler:"gc", Platform:"darwin/amd64"}
Kustomize Version: v5.0.1

For kubectl v1.28.0

% ./kubectl-v127 version --client 2>/dev/null
Client Version: v1.28.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3

Ref code blocks:

Possible solution to the issue:

Rewrite the logic of kubectl.GetVersionInfo(ktl) to make it compatible with new/old version by changing the command to kubectl version --output json just like we have done before at #5280

@guessi
Copy link
Contributor

guessi commented Aug 19, 2023

I believe it should only affect users who use kubectl 1.28.0+, where you may find the change at upstream PR below.


The quickest way to resolve this issue for now is to downgrade your kubectl to version below v1.28.0.

For example, if you are macOS user, you may backup original kubectl and replace it with the old one.

$ mv -vf $(which kubectl) ./kubectl.orig

$ curl -LO "https://dl.k8s.io/release/v1.27.4/bin/darwin/amd64/kubectl"

$ chmod +x ./kubectl

$ ./kubectl version # make sure you download version below v1.28.0

$ mv -v ./kubectl $(which kubectl)

@TiberiuGC
Copy link
Collaborator

TiberiuGC commented Aug 21, 2023

Thanks a lot for investigating this issue @guessi! 🔥 We'll look for a solution internally based on your insights.

@TechExplorer05
Copy link

I am having the same issue on windows 11 running latest eksctl and kubectl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants