In our previous post, Part 1 - Setup a EKS Cluster we went through the steps on how to Setup a EKS Cluster.
What are we doing today
In this post, we will deploy a sample web application to EKS and access our application using a ELB that EKS provides us.
We will have two manifests that we will deploy to Kubernetes, a deployment manifest that will hold the information about our application and a service manifest that will hold the information about the service load balancer.
The deployment manifest, you will notice that we are specifying that we want 3 containers, we are using labels so that our service and deployment can find each other and we are using a basic http web application that will listen on port 8000 inside the container:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
The service manifest, you will notice that we are specifying
type: LoadBalancer in our service manifest, this will tell EKS to provision a ELB for your application so that we can access our application from the internet.
You will see that the selector is specifying
my-app which we also provided in our deployment.yml so that our service know where to find our backend application. We are also stating that the service is listening on port 80, and will forward its traffic to our deployment on port 8000:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Deploy our application:
Deploy our service:
Now when we look at our deployment, we should see that 3 replicas of our application is running:
1 2 3
To see the pods of that deployment, look at the pods:
1 2 3 4 5
As we have more than one service in our EKS cluster, we can specify the labels that we have applied on our manifests to filter what we want to see (
1 2 3
As we can see EKS provisioned a ELB for us, and we can access the application by making a HTTP request:
1 2 3 4 5 6 7
Scaling our Deployment
Let’s scale our deployment to 5 replicas:
After all the pods has been deployed, you should be able to see the 5 out of 5 pods that we provisioned, should be running:
1 2 3
We can then also see the pods that our deployment is referencing:
1 2 3 4 5 6 7
Further Reading on Kubernetes
This is one amazing resource that covers a lot of kubernetes topics and will help you throughout your EKS journey:
Let me know what you think. If you liked my content, feel free to checkout my content on ruan.dev or follow me on twitter at @ruanbekker