This project is build because I wanted to learn more about Kubernetes and how the services work. I also wanted to learn more about Microservices. For future references I can use this project to go further into communicating components. Like rabbitMQ.
First I created an authentication service. Here you can do the following:
- Register a user.
- Login a user.
When you log in with a registered user, you get a JSON token for authentication with other services. The image service uses this JSON token to authenticate if the user can use this service.
First I created the database to store the images. I wanted to create the database and service inside my Kubernetes Cluster. I connected a SSD drive to the cluster for storage purpose, and I used this guide to know how to store items on it. Then I created the configmap. This is where I stored the password, username and the database-name. Location of 🔗database YAML files.
- Connected SSD to the server. Used this 🔗guide to figure out how to connect to it and where it is stored.
- Created configmap - for storing user data for connecting to the database. Here I used documentation from 🔗Rancher.
- Created the storage - This part is most important because this is where I specify where to store the files.
- Created the deployment - This is the pod. When something goes wrong with the database this is the thing that replicates and restarts the services.
- Created the service - This is for exposing the pod. This is, so I can connect an outside service to it like the database local on my laptop.
For deploying I created a dockerfile for each microservice. This is used for creating images. The images I can use on any platform I want as long as I deploy with Docker buildx. Buildx is an experimental feature of Docker. I used the following actions:
- ✅ Action for check out
- ✅ Docker action for QMU
- ✅ Docker action for buildx
- ✅ Docker action for login
- ✅ Docker action for build and push
- ✅ Action for pushing files to a local kubernetes cluster
Location for deployment files:
For testing an application capability's on a kubernetes cluster I searched the internet for 'How to load test an application in a kubernetes cluster.' This is when I found locust. This framework can be used to load test and simulate Users.
For the first test I started with a replicaset of 2 pods, 100 users at a spawn rate of 10.
which saw the following results:
Here you can see that I get 55 Requests per second. After this I tried to scale up. I scaled up to a replicaset of 10.
The result I got where the following.
With more replicasets I get more requests per second. The median response time also goes down, from 1700 to 900 ms. Hence I get more throughput when I use a bigger replicaset with the same amount of users, eventhough I make use of one loadbalancer.