Skip to content

microservices used to test load on a k3s kubernetes cluster. Create in minor OpenInnovation S7.

Notifications You must be signed in to change notification settings

teundeclercq/image-authentication-microservice

Repository files navigation

🌟 Image Authentication Microservices 🌟

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.


Creating the microservices 💭

First I created an authentication service. Here you can do the following:

  • Register a user.

postman_image_register

  • Login a user.

postman_image_login

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.

postman_image

Creating the database 🔐

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.

  1. Connected SSD to the server. Used this 🔗guide to figure out how to connect to it and where it is stored.
  2. Created configmap - for storing user data for connecting to the database. Here I used documentation from 🔗Rancher.
  3. Created the storage - This part is most important because this is where I specify where to store the files. hostImagePath
  4. Created the deployment - This is the pod. When something goes wrong with the database this is the thing that replicates and restarts the services.
  5. 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.

Creating the deployments ⚡

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:

Location for deployment files:

Testing the deployments 🏁

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.

loadUsers

which saw the following results:

imageSchema2Replica

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.

imageReplicaKubernetes

The result I got where the following.

locustResult10Replica

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.

About

microservices used to test load on a k3s kubernetes cluster. Create in minor OpenInnovation S7.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published