Home > OS >  Error `executable aws not found` with kubectl config defined by `aws eks update-kubeconfig`
Error `executable aws not found` with kubectl config defined by `aws eks update-kubeconfig`

Time:02-22

I defined my KUBECONFIG for the AWS EKS cluster:

aws eks update-kubeconfig --region eu-west-1 --name yb-demo

but got the following error when using kubectl:

...
Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).
[opc@C eks]$ kubectl get sc
Unable to connect to the server: getting credentials: exec: executable aws not found

It looks like you are trying to use a client-go credential plugin that is not installed.

To learn more about this feature, consult the documentation available at:
      https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins

CodePudding user response:

It seems that in ~/.kube/config the command: aws doesn't use the PATH environment and doesn't find it. Here is how to change it to the full path:

sed -e "/command: aws/s?aws?$(which aws)?" -i ~/.kube/config

CodePudding user response:

You can also append your custom aws cli installation path to the $PATH variable in ~/.bash_profile: export PATH=$PATH:<path to aws cli program directory>. This way you do not need to sed the kubeconfig file every time you add an EKS cluster. Also you will be able to use aws command at the command prompt without specifying full path to the program for every execution.

  • Related