Kubectl and aws cli setup in Linux

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

Steps:

  1. Linux:

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

     brew install kubectl
    
  3. Windows:

  4. Verify the installation:

     kubectl version --short --client
    

Configuring AWS CLI:

  1. Install AWS CLI:

  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