Deploying a Micro-service Application on Amazon EKS

In this blog, I'll walk you through the manual process of deploying a micro-service application in an Amazon EKS cluster, along with the problems we run into and how to fix them. At the conclusion of this, you will have an AWS load balancer-accessible, fully operational voting application operating in EKS for external users.

GitHub repository: Voting application

Architecture of our voting application

Components of our application:

  • Voting Service: Manages the voting logic and stores votes.

  • Result Service: Aggregates and displays voting results.

  • Worker Service: Handles background processing tasks.

  • Database Services: Separate databases (Redis for caching and PostgreSQL for persistent storage).

When a user casts a vote, the voting service processes the data and temporarily stores it in the Redis service. A worker service then selects the data from Redis and updates it in PostgreSQL. The result service retrieves the information from the PostgreSQL database when the user accesses the results. This is our voting application's general architecture.

Deploy voting application in EKS cluster.

Prerequisites

Before we start, ensure you have the following:

  1. AWS Account: An AWS account with permissions to create and manage EKS clusters.

  2. AWS CLI: Installed and configured on your machine.

  3. kubectl: Installed and configured to interact with your EKS cluster.

  4. Docker: Installed to build and manage container images.

Create and set up EKS cluster:

  1. Login to the AWS Management Console and navigate to the EKS service.

  2. Click on Create cluster.

  3. Configure the cluster name, Kubernetes version, and the IAM role for the EKS cluster. Make sure you have created the necessary IAM role with the required policies.

  4. Configure the networking settings, including VPC, subnets, and security groups.

  5. Review and create the cluster.

  6. Once the cluster is ready create a node group and configure the desired number of nodes.

Configure kubectl for EKS

Once the cluster is created, configure kubectl to connect to your EKS cluster:

aws eks --region <region> update-kubeconfig --name <cluster_name>

Deploying the Voting Micro-service Application:

Clone the kubernetes manifest files for each services and the source code from the git hub repository.

git clone https://github.com/Govind2439/vote-application.git
cd voting-application

A directory called k8s-specifications is present. You will find all of the manifest files for services and deployments inside of this directory.

use the "kubectl" to apply the configuration files

kubectl apply -f vote-deployment.yaml
kubectl apply -f vote-service.yaml
kubectl apply -f result-deployment.yaml
kubectl apply -f result-service.yaml
kubectl apply -f worker-deployment.yaml
kubectl apply -f redis-deployment.yaml
kubectl apply -f redis-service.yaml
kubectl apply -f postgres-deployment.yaml
kubectl apply -f postgres-service.yaml

Check whether the pods and services are deployed in the cluster

# To get the deployments
kubectl get deployments
# To get the pods
kubectl get pods
# To get the services
kubectl get services

Accessing the Application

Once all the services are deployed, you can access your voting application via the load balancer's public IP. Use the following command to get the external IP of the services:

kubectl get services -o wide

Find the external IPs for the vote and result services and open them in your browser to access the voting and result applications.

Common issues:

The EC2 dashboard indicates that the nodes in the node group are ready, but their status is not ready.
Solution: When forming a node group, give each node the CNI permissions role.
Pods cannot be launched from the local machine into the cluster.
When the person who established the EKS cluster is different from the one who configured the local machine for AWS, this problem arises. Grant the user cluster admin permissions to resolve the issue.
External load balancer URL cannot be accessed
Solution: Verify that ports 80 and 443 are open to all IP addresses in the security group that is assigned to the node group.
Loadbalancer DNS is responding and loading more slowly.
Copy the IP address from "nslookup DNS". It is possible to access your application using the IP address.

Conclusion

We manually installed a voting micro-service application on an Amazon EKS cluster in this blog article. We went over how to set up the AWS load balancer, configure the application, and make sure it is reachable by outside users in addition to discussing common issues and their fixes.

The identical coding procedures will be followed in the upcoming post as we use Terraform to deploy the same application in the EKS Cluster.

Please feel free to post any questions in the comments session below!

0
Subscribe to my newsletter

Read articles from Govinda Kothakota directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Govinda Kothakota
Govinda Kothakota

DevOps Engineer who aims to improve the efficiency of the organization by automating tasks. Passionate about open source.