Eksctl: Error: Unable to connect to the server: getting credentials: exec: exec: "aws": executable file not found in $PATH

Created on 18 Nov 2019  Â·  12Comments  Â·  Source: weaveworks/eksctl

What happened?
Error: Unable to connect to the server: getting credentials: exec: exec: "aws": executable file not found in $PATH

I successfully created a cluster with $ eksctl create cluster

Then successfully ran: $ sudo aws2 eks --region ${REGION} update-kubeconfig --name ${CLUSTER_ID}

Then tried $ kubectl get nodes but got the error listed above.

In addition, $ aws-iam-authenticator init returns could not get config: cluster ID cannot be empty

Anything else we need to know?

  • OS: Mac
  • Download eksctl from binary
  • Download aws-iam-authenticator from homebrew
  • I was able to create a cluster without kubectl installed yet

Versions

$ eksctl version:  "0.9.0"
$ kubectl version: "v1.16.3"
$ aws-cli: v2

Logs
Include the output of the command line when running eksctl.

$ eksctl get clusters -v 4 returns
role ARN for the current session is "xxxxxxxxxxxxxx"
NAME REGION
${CLUSTER_ID} ${REGION}

To rule out IAM auth issues:
$ aws-iam-authenticator token -i environment_name.region.environment_type returns error-free

kinbug needs-investigation

Most helpful comment

Ok so somewhat similar to the issue #132 listed above, I fixed it I believe:

Edit the kub config file directly: $ vim "/Users/home_dir/.kube/config"

Go down to this section:

user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- --region
- xxxxxregion_namexxxxx
- eks
- get-token
- --cluster-name
- xxxxxxxxxxxxcluster_idxxxxx
command: aws

and change the command field to: aws2

You should now be able to run:
$ eksctl get clusters
$ kubectl get svc --all-namespaces

All 12 comments

I'm thinking this is happening b/c for cli version 2 I have to use aws2-based commands not aws, should I switch to v1?

Similar issue reported here: https://github.com/kubernetes-sigs/aws-iam-authenticator/issues/132

Same issue on Windows 10 workstation

Unable to connect to the server: getting credentials: exec: exec: "aws": executable file not found in %PATH%

Ok so somewhat similar to the issue #132 listed above, I fixed it I believe:

Edit the kub config file directly: $ vim "/Users/home_dir/.kube/config"

Go down to this section:

user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- --region
- xxxxxregion_namexxxxx
- eks
- get-token
- --cluster-name
- xxxxxxxxxxxxcluster_idxxxxx
command: aws

and change the command field to: aws2

You should now be able to run:
$ eksctl get clusters
$ kubectl get svc --all-namespaces

What is the long term solution for this issue?

Hi Experts,
I have aws cli version aws-cli/2.0.7 Python/3.7.5 Windows/8.1 botocore/2.0.0dev11 .
eksctl version 0.16.0
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:53:57Z", GoVersion:"
go1.12.1", Compiler:"gc", Platform:"windows/amd64"}

But while giving command eksctl version for server i am getting below response :+1:
Unable to connect to the server: dial tcp 35.158.204.250:443: connectex: No connection could be made because the target machine actively refused it.

I tried verious version but no luck. I have windows 8 computer and trying to connect to AWS EKS cluster. I am able to create cluster successfully with eksctl.

Kindly help !

I'm facing similar issue while switching to user (devops) from root user on RedHat linx OS machine.

su - devops

Last login: Tue Apr 21 05:57:03 UTC 2020 on pts/3
Unable to connect to the server: getting credentials: exec: exec: "aws": executable file not found in $PATH

aws cli version is v1 only and ~/.kube/config has below settings:

user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- --region
- ap-northeast-1
- eks
- get-token
- --cluster-name
- xxxxxxxxxxxxxxxxxxxxxx
command: aws
env:
- name: AWS_PROFILE
value: xxxxxxxxxxx

$ aws --version
aws-cli/1.18.39 Python/2.7.5 Linux/3.10.0-862.11.6.el7.x86_64 botocore/1.15.39

Please help to resolve it!

I'm facing similar issue while switching to user (devops) from root user on RedHat linx OS machine.

su - devops

Last login: Tue Apr 21 05:57:03 UTC 2020 on pts/3
Unable to connect to the server: getting credentials: exec: exec: "aws": executable file not found in $PATH

aws cli version is v1 only and ~/.kube/config has below settings:

user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:

  • --region
  • ap-northeast-1
  • eks
  • get-token
  • --cluster-name
  • xxxxxxxxxxxxxxxxxxxxxx
    command: aws
    env:
  • name: AWS_PROFILE
    value: xxxxxxxxxxx

$ aws --version
aws-cli/1.18.39 Python/2.7.5 Linux/3.10.0-862.11.6.el7.x86_64 botocore/1.15.39

Please help to resolve it!

Do a "which aws" for me it is /usr/local/bin/aws and then mention the whole path in kubeconfig file command: /usr/local/bin/aws

See if this helps

I'm facing similar issue while switching to user (devops) from root user on RedHat linx OS machine.

su - devops

Last login: Tue Apr 21 05:57:03 UTC 2020 on pts/3
Unable to connect to the server: getting credentials: exec: exec: "aws": executable file not found in $PATH
aws cli version is v1 only and ~/.kube/config has below settings:
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:

  • --region
  • ap-northeast-1
  • eks
  • get-token
  • --cluster-name
  • xxxxxxxxxxxxxxxxxxxxxx
    command: aws
    env:
  • name: AWS_PROFILE
    value: xxxxxxxxxxx

$ aws --version
aws-cli/1.18.39 Python/2.7.5 Linux/3.10.0-862.11.6.el7.x86_64 botocore/1.15.39
Please help to resolve it!

Do a "which aws" for me it is /usr/local/bin/aws and then mention the whole path in kubeconfig file command: /usr/local/bin/aws

See if this helps

Thanks @ssaila . Indeed it helped when I provided full path.

For me it was under ~/.local/bin/ and I have to provide full path /home/devops/.local/bin/aws

There seem to be 2 issues here:

  1. updating configs with aws2 eks and it's overwriting configs from eksctl, nothing can be done about this in eksctl. (covered here https://github.com/aws/aws-cli/issues/4675)
  2. using the same config across different users or where PATH is different. I'm not convinced this is something we want to handle specifically.

    1. Use cases mentioned in https://github.com/aws/aws-cli/issues/4675#issuecomment-599912602 where the same user effectively has different PATH settings. These seem like cases of misconfiguration.

    2. Should different users be using the same kubeconfig? Even if they are, I think we can expect aws to be in PATH for both of them.

To write the whole path of the executable would bypass the purpose of PATH.

Closing this, if the above solutions/comments don't work for you, let us know here.

Same issue on Windows 10 workstation

Unable to connect to the server: getting credentials: exec: exec: "aws": executable file not found in %PATH%

what is the solution for this error

Same issue on Windows 10 workstation
Unable to connect to the server: getting credentials: exec: exec: "aws": executable file not found in %PATH%

what is the solution for this error

Do a "which aws" (for eg : /usr/local/bin/aws) and then mention the whole path in kubeconfig file command: /usr/local/bin/aws

Was this page helpful?
0 / 5 - 0 ratings