Skip to main content

Command Palette

Search for a command to run...

Kubectl and aws cli setup in Linux

Will learn today about how to Setting up kubectl and configuring AWS CLI are crucial steps for managing Kubernetes clusters on Amazon EKS (Elastic Kub

Updated
2 min readView as Markdown
Kubectl and aws cli setup in Linux
S

Aspiring Tech Enthusiast on a Journey from Freshman to Tech Lead
Passionate about Fintech | Fluent in .NET, JavaScript, GoLang, Linux, Kubernetes, Docker | Crafting with Node.js & React.js |

Join me in exploring the intersection of finance and cutting-edge technology!

#TechJourney

#FintechExplorer

#CodeCraftsman

Steps:

  1. Linux:

     sudo apt-get update && sudo apt-get install -y kubectl
    
  2. MacOS:

     brew install kubectl
    
  3. Windows:

    • Download the latest version of kubectl from the official Kubernetes release page: https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/

    • Add the downloaded executable to your system's PATH.

  4. Verify the installation:

     kubectl version --short --client
    

Configuring AWS CLI:

  1. Install AWS CLI:

    • Follow the instructions here: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
  2. Configure AWS CLI:

     aws configure
    
    • You'll be prompted to enter your AWS access key, secret key, default region, and output format.
  3. Verify AWS CLI Configuration:

     aws ec2 describe-instances
    

Setting up AWS IAM for EKS:

  1. Create IAM Role:

    • Open the IAM console in the AWS Management Console.

    • Navigate to "Roles" and click "Create Role."

    • Choose "EKS" as the service that will use this role and select "Allows Amazon EKS to manage your clusters."

  2. Attach Policies:

    • Attach the policies AmazonEKSClusterPolicy and AmazonEKSServicePolicy to the role.
  3. Create Kubernetes Config:

    • After creating the EKS cluster, update your kubeconfig with the cluster details.

        aws eks --region <region> update-kubeconfig --name <cluster_name>
      
  4. Verify Configuration:

     kubectl get nodes
    

Additional Tips:

  • Ensure that you have the necessary AWS CLI and kubectl versions compatible with your EKS cluster.

  • Always follow security best practices, such as restricting AWS IAM permissions to the minimum required.

  • Keep your AWS CLI and kubectl configurations secure, especially access keys and secrets.

These steps provide a basic setup for using kubectl with AWS EKS. For more detailed information, refer to the official documentation for kubectl and AWS CLI.

#everystepstowardmoreproductivity

#staycurious

#stayhealthydeveloper