Skip to content

This is the Udacity project to split the udagram application in microservice and deploy it in Kubernetes cluster in AWS.

Notifications You must be signed in to change notification settings

Talismanic/microservice-in-eks

Repository files navigation

microservice-in-eks

This is the Udacity project to split the udagram application in microservice and deploy it in Kubernetes cluster in AWS.

Install the below items:

1. eksctl

2. docker

3. docker-compose

Step 01

After decomposing the services, please run the following command to make the docker images and push the images to registry (docker hub).

docker-compose -f docker-compose-build.yaml build

docker-compose -f docker-compose-build.yaml push

Check the images in docker hub. We should see something like below:

docker-hub-images

In case you want to use my images, you can find those here:

frontend

feed service

user service

reverseproxy

Step 02

Now to spin up the cluster run the following command:

eksctl create cluster --name MyClusterName --version 1.14 --nodegroup-name standard-workers --node-type t3.medium --nodes 3 --nodes-min 1 --nodes-max 4 --node-ami auto

Step 03

Change the type of the services of Frontend and Reverseproxy to Loadbalancer in the yaml definition of the services.

Run below command to spin the application:

kubectl apply -f .

If everything is alright, then run the following command to see all the resources:

kubectl get all

Above command should bring the resoucres like below udagram-kubectl-get-all

Step 04

As the frontend and reverseproxy services has been added as LoadBalancer, you will see that AWS has attached public interface in the external load balancer field. Other two services are running as the ClusterIP type.

Now you need to copy the reverse proxy EXTERNAL_IP and change the configuration of the front end prod & frond end to use this IP as backend instead of localhost. Note that, to access the feed and user service from frontend service from browser, you need to add CORS header in the nginx.conf file. Details changes are inside the repo. Now rebuild the docker image for frontend service and reverse proxy following step 01. Then update the kubernetes deployments applying kubectl apply command similar to step 03.

Step 04

To check whether the application is accessible, please copy the EXTERNAL-IP of frontend service and open it in browser with port 8100. This should bring the frontend like below:

udagram-running-browser

Step 05

Integrating with Travis-CI

Connect your Github Repo with TravisCI. Make the changes mentioned in the .travis.yml file. Go to settings of the project and add all the required environment variables mentioned in the configuration files of the backend services. Then make any change in the code base and push it to Repo. This should automatically trigger the build and after successful build you should see something like below:

travis-ci-build

Step 06

When you have collected all your artifacts required to submit the assignment, do not forget to clear the cluster to avoid additional charging. Please use below command to clear this.

eksctl delete cluster --name=MyClusterName

This commit is for test

About

This is the Udacity project to split the udagram application in microservice and deploy it in Kubernetes cluster in AWS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published