eksctl icon indicating copy to clipboard operation
eksctl copied to clipboard

[Bug] Incompatible with latest `kubectl` release

Open stmcginnis opened this issue 3 years ago • 2 comments

What were you trying to accomplish?

Attempting to create a new EKS cluster.

What happened?

Creating a new EKS cluster on a new system, I had installed kubectl using the instructions on the Linux install page:

curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"

This installs the latest stable release of kubectl, which appears to be version v1.25.0 at this point.

I then attempt to create the new cluster. All goes well until the end where an error is emitted due to unexpected output from kubectl version:

$ eksctl create cluster --region us-east-2 --name test
2022-09-09 17:01:01 [ℹ]  eksctl version 0.107.0
2022-09-09 17:01:01 [ℹ]  using region us-east-2
2022-09-09 17:01:01 [ℹ]  setting availability zones to [us-east-2b us-east-2c us-east-2a]
...
2022-09-09 17:18:07 [✖]  unable to use kubectl with the EKS cluster (check 'kubectl version'): WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Unable to connect to the server: getting credentials: decoding stdout: no kind "ExecCredential" is registered for version "client.authentication.k8s.io/v1alpha1" in scheme "pkg/client/auth/exec/exec.go:62"

2022-09-09 17:18:07 [ℹ]  cluster should be functional despite missing (or misconfigured) client binaries
2022-09-09 17:18:07 [✔]  EKS cluster "test" in "us-east-2" region is ready

It looks like this is due to kubectl deprecating/changing the output format for kubectl version --short:

$ kubectl version --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.25.0
Kustomize Version: v4.5.7

Versus the "old" output from the v1.22.0 release:

kubectl version --short
Client Version: v1.22.0

How to reproduce it?

Appears to be reproducible with any cluster creation attempt having at least kubectl v1.25.0 or later installed.

Versions

$ eksctl info
eksctl version: 0.107.0
kubectl version: v1.25.0
OS: linux

stmcginnis avatar Sep 09 '22 17:09 stmcginnis

Hello stmcginnis :wave: Thank you for opening an issue in eksctl project. The team will review the issue and aim to respond within 1-3 business days. Meanwhile, please read about the Contribution and Code of Conduct guidelines here. You can find out more information about eksctl on our website

github-actions[bot] avatar Sep 09 '22 17:09 github-actions[bot]

Hello - I've tried creating a cluster with kubectl version 1.25.0 and it worked just fine for me.

The error you're seeing above doesn't have to do with the format of kubectl version --short. Printing this output is just a default thing we're doing in case we're getting an error when "asking" kubectl for its version. See the error here and the suggestion we're printing here.

The actual issue you're facing seems to be displayed on the line below: Unable to connect to the server: getting credentials: decoding stdout: no kind "ExecCredential" is registered for version "client.authentication.k8s.io/v1alpha1" in scheme "pkg/client/auth/exec/exec.go:62"

Checking my kubeconfig I notice that I'm using a different client authentication version: apiVersion: client.authentication.k8s.io/v1beta1

Could you please try

  • upgrading to latest aws cli
  • run eksctl utils write-kubeconfig --cluster=<name>
  • check in your ~/.kube/config file that apiVersion has been updated to client.authentication.k8s.io/v1beta1

Afterwards kubectl commands should work on your cluster. :crossed_fingers:

TiberiuGC avatar Sep 21 '22 09:09 TiberiuGC

Duplicate of #5257?

jglick avatar Oct 11 '22 15:10 jglick

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Nov 11 '22 02:11 github-actions[bot]

Sorry, somehow missed previous comments.

stmcginnis avatar Nov 11 '22 17:11 stmcginnis

@stmcginnis no worries, thanks for closing this one.

TiberiuGC avatar Nov 14 '22 08:11 TiberiuGC