Setting up AWS EKS and sample k8s app

The post shows how you can quickly set up a Kubernetes cluster in AWS and run a sample Kubernetes app on it.

Setting up Kubernetes (EKS)

There are 2 ways to do this (1) AWS Console and (2) Command Line Interface (CLI)

1) AWS Console

Create Cluster

a) Navigate to EKS page and put a cluster name you wish to create under “Create EKS cluster”

b) Configure your cluster - name, k8s version, IAM role

To set up an IAM role -

c) Select VPC and Subnet. If you want to expose your k8s to the internet, choose a public subnet.

d) Keep the default “configure logging” setting. Review and create

Create Node

a) Add node group

b) Choose AMI and Instance type (choose at least medium) - note "instance type" dictate the number of IPs allowed per node. Select your scaling

c) Choose subnet. The subnet here should be a subset of subnets selected while creating the cluster.

d) Review and create the cluster

2) Command Line Interface (CLI)

CLI is pretty slick if you install eksctl -

Also, this is a good way to choose Ubuntu AMI for the node machine. The console approach does not allow you to launch Ubuntu AMI.

Create a cluster and Nodes

eksctl create cluster --node-ami=Ubuntu1804
# created a cluster “floral-sculpture-1600963464, using ubuntu 
# AMI. If you dont choose an AMI it will pick AmazonLinux.

eksctl create nodegroup --cluster=floral-sculpture-1600963464 --name=testu --node-ami-family Ubuntu1804  --node-volume-size=45 --ssh-public-key="~/.ssh/"
# Attach node groups to the cluster

Access your cluster

After the k8s cluster and nodes are created (either through CLI or console), the next step is to access it

aws eks --region us-west-2 update-kubeconfig --name k8s-test-cluster
# Added new context arn:aws:eks:us-west-2:693683647:cluster/k8s-test-cluster to /home/ec2-user/.kube/config

kubectl get svc -A 
# to test if you have access

kubectl config current-context
# arn:aws:eks:us-west-2:693683647262:cluster/k8s-test-cluster
# to check which cluster you are connected to

Launching an opensource k8s app on your cluster

# Create a directory
mkdir google
cd google

# Download googleshopping app from git hub
git clone

# Go to the directory
cd microservices-demo/release

# Create a namespace
kubectl create ns gshop

# Run the file
kubectl apply -f kubernetes-manifests.yaml --namespace=gshop

# Get the IP for external service to log from a browser
kubectl get svc -A

Open a browser, log into the external IP, you should be able to see this page

16 views0 comments


Icons made by Flaticon


39812 Mission Blvd. Suite 224
Fremont, CA 94539 USA

  • White LinkedIn Icon
  • White Twitter Icon