December 5, 2020

8 Links

8 Links of Separation

Spin Up Kubernetes on AWS Under 10 min | by Moon | Nov, 2020

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!)

Go to the AWS website and register an account as you would on any website.

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 am motivated to get familiar with billing dashboard and setting alert things like that.

You will need three CLIs to run your Kubernetes clusters. They are:

(1) For Mac:

(2) For Windows

Download and install awscli as any other program:

mkdir kubectlbinary
cd kubectlbinary
curl -o kubectl.exe
kubectl version --short --client
kubectl version --client

Download and install eksctl as any other program:

(1) Create EKS Cluster without nodegroup

Copy the following commands to whatever terminal you are using

eksctl create cluster --name=demo-1 

(2) IAM OIDC Provider

Copy the following commands to whatever terminal you are using

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

(3) Create Keypair

Use the command below to create a key called k8s-demo.pem

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

(4) Create Node Group

Make sure you are in the directory of your computer where the pem file above is create, then type the command below.

eksctl create nodegroup --cluster=demo-1 

(5) Verify it is running

eksctl get cluster

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

demo-1 us-east-1

(6) Delete the Cluster

To avoid further charges, you can delete you the cluster you just created by simply typing the command below.

eksctl delete cluster demo-1