Create Kubernetes cluster on EKS

I know a lot of people out there have become fan of k8s and so Iam. Recently I deployed my personal project on EKS. I prefer to choose gitlab for ci-cd because as it is widely said — ‘Gitlab is the future of devops’. So lets begin with the first part.

First we need to create an EKS cluster. Earlier I preferred using kops to create that but here we are going to use eksctl — amazon’s own k8s command line tool since there are some extra steps of manual work that needs to be done using kops like explicitly creating a S3 bucket.

Prerequisites — You need to own a AWS account

  1. Navigate to IAM services in AWS console after logging in and create a user. Give it a programmatic access only. Store safe your ACCESS_KEY_ID and SECRET_ACCESS_KEY.
  2. In your local machine install aws-cli. In awscliv1 you needed to install python to download it. But latest awscliv2 doesnt have any requisites and u can install it with these 3 simple commands.

a) curl “https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o “awscliv2.zip”

b) unzip awscliv2.zip

c) sudo ./aws/install

d) aws — version

3. Now configure aws account in your local machine. Just type aws configure and it will ask for ACCESS_KEY_ID and SECRET_ACCESS_KEY. Input the values you stored in step 1 and leave rest configuration options to default.

4. test the user by typing aws sts get-caller-identity OR aws iam list-users You should see your latest configurations in output

5. Next you will have to install eksctl — Elastic kubernetes service’s command line tool that manages eks cluster

For Linux users

a) curl — silent — location “https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz” | tar xz -C /tmp

b) sudo mv /tmp/eksctl /usr/local/bin

c) eksctl version

For MacOs

a) brew install weaveworks/tap/eksctl

6. Next type a simple eksctl command to create a cluster on AWS.

a) eksctl create cluster — name=my-eks-cluster

to create cluster, eksctl command uses your aws user that you configured in step 3. Ideally I would suggest to export a variable on your machine named CLUSTER and we will using that variable to create a cluster, since going forward we will need cluster name repeatedly.

a) export CLUSTER=my-cluster

b) eksctl create cluster — name=${CLUSTER} This will create a cluster with default configurations or either you can create a yaml file as below and run the command `eksctl create cluster -f cluster.yaml`

#cluster.yamlapiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: taskmanager-cluster
region: ap-southeast-1
nodeGroups:
- name: ng-1
instanceType: t2.small
desiredCapacity: 1
ssh:
allow: true

Voila! Within 10–15 minutes your eks cluster will up and ready.

In next part we will create a simple k8s project locally and configure this cluster in gitlab to automate the ci-cd process.

--

--

--

A Javascript Full-Stack Developer. A Cloud learner

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Three Developer Articles that Interested Me This Week — 06/27/2022

hot config reload with OS signal

Shifting to Linux and macOS from Windows

Ace Business Multitasking With A Market Data API

CS373 Spring 2022: Abhinav Mugunda

Road TO Dev — Let’s animate!

Swift 5.7 | What’s new in optional binding ?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rajneesh Mishra

Rajneesh Mishra

A Javascript Full-Stack Developer. A Cloud learner

More from Medium

Play with helm-part 2

Jenkins Declarative Pipeline Essentials

Backup and restore Gitlab in docker

Server Monitoring Guide: Using Prometheus, Grafana And Node_Exporter For Easy Server Monitoring