Error Solving : -bash: /usr/local/bin/kubectl: cannot execute binary file : after Kubernetes installation: you're trying to run the kubectl command on an EC2 instance in AWS

you're trying to run the kubectl command on an EC2 instance in AWS, the first thing to check is whether you've downloaded the correct version of kubectl for your instance's operating system and architecture.


follow these steps to resolve it:

You can download the correct version of kubectl using the following commands:

For Linux x86_64:

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

copy this link and paste it into your terminal and press Enter.


if your system requires arm64 then copy the below link and paste it into the terminal and Enter.

For Linux arm64:

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


you will get the following screen.



now,

Make sure you have the correct version of kubectl for your system architecture.

Once you have the correct version of kubectl, Enter the following command:

==> chmod +x kubectl



Then, move the kubectl binary to a directory in your $PATH, such as /usr/local/bin/ by running the following command:

==> sudo mv kubectl /usr/local/bin/


 

After all these steps completion Enter the command: kubectl and press Enter if you get the following screen you have successfully completed.


Now, Your error is resolved, you can access your Kubernetes command easily.

THANK YOU  

Comments

Popular posts from this blog

Nodejs Application project : using Aws, Jenkins, Docker, Kubernetes

Create two public subnets and two private subnets in two different availability zones(AZ) ( one public and one private subnet in each AZ).Create an instance of webserver (like apache ) in each AZ and an instance of db server in any AZ. Attach web servers to ELB and make sure to support cross zone availability.