Spin Up Kubernetes on AWS Under 30 min Prep

You usually can get some free credits if this is your first time registering your AWS account, but this whole series should take less than 2 hours, so even if you pay for it out of your own pocket, it will be less than $0.20.

(You can see the last picture in this blog where I run my cluster for more than 10 hours and it only cost $0.78. With that being said, it does happen that you accidentally did not turn off your services and get charged $100 at the end of the month, but as long as you follow my instructions step by step, that should not happen. If you are interested in, I will show you extra steps on how to monitor and alert your bills at the end of the series. But for now, let’s not worry about it yet!)

Step 1. Set up your AWS account & Payment

Once you log in, you can see this overwhelming panel throwing everything that you don’t need at this moment. Ignore them and just type “billing” in the search bar on the top. You will end up on the billing page as shown on the second picture.

(As you can see, I spent only $0.78 for running a Kubernetes cluster for more than 10 hours)

Once you are on the billing page, you can go check if you have credit to use under the credit tab, or you can simply add your credit card. I know it’s generally not a good idea to add your credit card to any website unless you 100% needs it, but that’s how I was motivated to get familiar with billing dashboard and setting alert things like that.

Step 2. Install CLIs

  • AWS CLI
  • kubectl
  • eksctl

(1) For Mac:

(2) For Windows

Download and install awscli as any other program: https://awscli.amazonaws.com/AWSCLIV2.msi

Then run the following command in your powershell:

mkdir kubectlbinary
cd kubectlbinary
curl -o kubectl.exe https://amazon-eks.s3.us-west-2.amazonaws.com/1.16.8/2020-04-16/bin/windows/amd64/kubectl.exe
C:\Users\KALYAN\Documents\kubectlbinary
kubectl version --short --client
kubectl version --client

Download and install eksctl as any other program: https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html#installing-eksctl

Step 3. Start your cluster

(1) Create EKS Cluster without nodegroup

eksctl create cluster --name=demo-1 \
--region=us-east-1 \
--zones=us-east-1a,us-east-1b \
--without-nodegroup

(2) IAM OIDC Provider

eksctl utils associate-iam-oidc-provider \
--region us-east-1 \
--cluster demo-1 \
--approve

(3) Create Keypair

aws ec2 create-key-pair - key-name k8s-demo - query 'KeyMaterial' - output text > k8s-demo.pem

(4) Create Node Group

eksctl create nodegroup --cluster=demo-1 \
--region=us-east-1 \
--name=demo1-nginx \
--node-type=t3.medium \
--nodes=2 \
--nodes-min=2 \
--nodes-max=4 \
--node-volume-size=20 \
--ssh-access \
--ssh-public-key=k8s-demo \
--managed \
--asg-access \
--external-dns-access \
--full-ecr-access \
--appmesh-access \
--alb-ingress-access

(5) Verify it is running

eksctl get cluster

Type the command above you should see some result like this:

NAME  REGION
demo-1 us-east-1

(6) Delete the Cluster

eksctl delete cluster demo-1

I am a Machine Learning Engineer with special interest in mental health and finance.

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