Up and running kubernetes cluster on aws eks in 10 minutes

In this post, I will share the post Up and running kubernetes cluster on aws eks in 10 minutes with cli tool called eksctl.

eksctl is cli tool written in GO by weaveworks and based on Amazon’s official CloudFormation templates.

Install eksctl

In our example, we will use wget, so make sure it is installed before you proceed.

curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/latest_release/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin

On MAC you can do

brew install weaveworks/tap/eksctl

Configure AWS API credentials

Install pip:

$ sudo apt-get install python-pip # For Ubuntu/Debian
$ sudo yum install python-pip # For CentOS
$ sudo pacman -S python-pip # For Arch Linux / Manjaro

You can now install an awscli package using pip:

$ sudo pip install awscli

Let’s configure aws key/secret

$ aws configure
AWS Access Key ID [****************JO6B]: 
AWS Secret Access Key [****************78cd]: 
Default region name [<strong>us-west-2</strong>]: 
Default output format [<strong>json</strong>]:

Create Amazon EKS Cluster with eksctl

When all settings have been saved, you can now create a new cluster on EKS:

$eksctl create cluster

Options that can be used include:

-n, --name string : To specify EKS cluster name
-N, --nodes int: Total number of nodes, default is 2
-r, --region string:  AWS region (default "us-west-2")
-M, --nodes-max int:  Maximum nodes in ASG
-t, --node-type string: node instance type (default "m5.large")
-m, --nodes-min int:  Minimum nodes in ASG
--kubeconfig: String path to write kubeconfig. Default is ~.kube/config --ssh-public-key string: SSH public key to use for nodes: (default "~/.ssh/id_rsa.pub")

Let’s begin creating our first kubernetes cluster with eksctl

$ eksctl create cluster -n demo-cluster -N 2

Once you have created a cluster, the cluster credentials will be added in ~/.kube/config

To enable Auto Scaling Group for worker nodes group, use the options:

--nodes-min=2 --nodes-max=5 # Autoscaling btw 2-5

To get details about the deployed cluster or delete cluster:

$ eksctl get cluster -n demo-cluster
$ eksctl delete cluster --name=<name> [--region=<region>]

Deploying Kubernetes on AWS EKS service with eksctl is easy, you do not need to struggle with aws console in UI. All cluster configurations are saved on deployment machine, you can quickly make changes and update your cluster.

Also published on Medium.

Leave a Reply

Your email address will not be published. Required fields are marked *