Reputation: 189
I am trying to update kubeconfig file using the below mentioned CLI
aws eks update-kubeconfig --name EKS_cluster
It is giving me this error
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:
create-cluster | delete-cluster
describe-cluster | list-clusters
help
The was cli version I am using is
aws-cli/1.15.58 Python/3.5.2 Linux/5.3.0-1030-aws botocore/1.10.57
Can someone help me with this?
Upvotes: 3
Views: 6931
Reputation: 44579
From the docs of creating a kubeconfig for Amazon EKS here
Ensure that you have version 1.16.156 or later of the AWS CLI installed.
Clearly this is because of older version(1.15.58) of CLI. Upgrading the CLI should solve this issue.
Also now the CLI has got version 2 which you can install from here
Upvotes: 2
Reputation: 7105
Your version of the AWS-CLI needs to be updated. At the very least you need to be running AWS-CLI version 1.16.156 as mentioned in the AWS Docs.
Amazon EKS uses the aws eks get-token command, available in version 1.16.156 or later of the AWS CLI or the AWS IAM Authenticator for Kubernetes with kubectl for cluster authentication.
You'll also need to make sure you have AWS IAM Authenticator installed in order to authenticate using roles.
Download the Amazon EKS-vended aws-iam-authenticator binary from Amazon S3. To download the ARM version, change amd64 to arm64 before running the command.
curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.17.7/2020-07-08/bin/linux/amd64/aws-iam-authenticator
Apply execute permissions to the binary.
chmod +x ./aws-iam-authenticator
Copy the binary to a folder in your $PATH. We recommend creating a $HOME/bin/aws-iam-authenticator and ensuring that $HOME/bin comes first in your $PATH.
mkdir -p $HOME/bin && cp ./aws-iam-authenticator $HOME/bin/aws-iam-authenticator && export PATH=$PATH:$HOME/bin
Add $HOME/bin to your PATH environment variable.
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
Test that the aws-iam-authenticator binary works.
aws-iam-authenticator help
Upvotes: 1