Installing and Configuring AWS CLI and Kubernetes KubeCTL CLI on Windows

In Cloud Computing industry we can say AWS is one of the most popular among others for the benefits it provides.

Kubernetes is a software for deploying, scaling and managing docker based containerized applications and it is open source. Now a days Kubernetes is getting more popular in web application development DevOps culture of it’s Portability, Scalability, High Availability and Open Source advantages.

If you have your application Infrastructure is based on AWS powered Kubernetes cluster it’s always good to install KubeCTL CLI on your local machine to skip repeated ssh to your build server to manage your Kubernetes services. Here is how you can install AWS Kubernetes KubeCTL CLI on Windows with a simple few steps.

Step 1: Get AWS CLI Client installed

First you will need to get AWS CLI Client installed on your machine, you can get it from here https://aws.amazon.com/cli/

Just to make sure if it has been installed and accessible correctly you can test it via executing below code on your windows powershell

aws --version

You will get some information like this:

aws-cli/1.16.286 Python/2.7.16 Windows/10 botocore/1.13.22

Step 2: Get Kubernetes CLI Client installed

Secondly you will need to get Kubernetes CLI Client install on your machine which you can get from https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-windows

To see if it has been installed and accessible correctly you can test it via executing below code on your windows powershell

kubectl version

Step 3: Configure AWS CLI

To configire you aws cli you will need two information like aws_access_key_id and aws_secret_access_key and you can configure it by executing below command:

aws configure

AWS Access Key ID [None]: AKIAJXXXXXXEWDNXXXXX
AWS Secret Access Key [None]: 2EqCQXXXXXuK3LXXXXXtZXMGNXXXXXVCHd0XXXXX
Default region name [None]: eu-central-1
Default output format [None]: JSON

Step 4: Configure Amazon EKS (Elastic Kubernetes Service)

To configure Kubectl you can execute below command with region and cluster name flag, make sure that cluster has been created on your aws platform.

aws eks --region eu-central-1 update-kubeconfig --name phpfarmer-kube1

if things is fine you will get some response like below response and you are done!

Added new context arn:aws:eks:eu-central-1:012345678910:cluster/phpfarmer-kube1 to ..../.kube/config

Now you can travel with kubectl locally like:

kubectl get services #to list the services
kubectl get pods --all-namespaces #to list the pods
kubectl get pods -n testing
kubectl get pods -n production
kubectl get jobs -n testing #to list all the jobs on testing namespace
kubectl delete job phpfarmer-testing-migrate #to delete a job
kubectl describe pods phpfarmer-testing-569c58cff8-k6p2n -n testing #to describe a single pod
kubectl exec -it phpfarmer-testing-569c58cff8-k6p2n -n testing bash #to get inside a pod
kubectl logs phpfarmer-testing-569c58cff8-k6p2n #to get the log of specific pod
kubectl get ingress -n testing #get all ingress for testing namespace
kubectl describe ingress internal-ingress -n testing #describe a specific ingress

There are more here https://kubernetes.io/docs/reference/kubectl/cheatsheet/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: