This application is an e-commerce platform that assists users in selling and buying products. Users can sell their products by logging in and adding product details. Once added, the product will be displayed for customers to view and purchase.
The application is configured to run on Kubernetes. After creating a cluster in your cloud provider, we start by creating a persistent volume (PV) so that our database can persist the product details.
Before you begin, you need to clone this repository and set up your local environment.
-
First, clone the repository by running the following command:
git clone https://github.com/rashidjosphat/ip4.git
This will clone the repository to your local machine.
-
You will also need
kubectlfor communicating with your Kubernetes cluster. You can find a detailed explanation on how to install it in the Kubernetes installation guide.
In the mongodb-k8s folder, there is a file called mongo-pv.yml. This file will be used to provision our Persistent Volume (PV).
-
After navigating into the directory containing the YOLO files, apply the PV resource by running:
kubectl apply -f ./mongodb-k8s/mongo-pv.yml
-
To verify that the PV was created successfully, run the following command:
kubectl get pv
After successfully creating the PV, you need to create the Persistent Volume Claim (PVC) to bind the database to the PV.
-
Apply the PVC resource by running the following command:
kubectl apply -f ./mongodb-k8s/PVC.yml
-
To confirm that the PVC is running successfully, use the following commands:
kubectl get pvc kubectl get pv
After confirming that the PVC is running and successfully bound to the PV, you can now deploy MongoDB and its associated service.
-
Apply the MongoDB StatefulSet and service resource by running the following commands:
kubectl apply -f ./mongodb-k8s/stateful.yml kubectl apply -f ./mongodb-k8s/service.yml
This may take some time, depending on the image size, as it needs to pull the
mongo:latestimage as specified in thestateful.ymlfile. -
To check the status of the pods and ensure there are no errors, run:
kubectl describe pod mongodb-0
Note: While pods have unique names, because we are using a StatefulSet, the pod name will be incremented (i.e.,
mongodb-0,mongodb-1, etc.). Thedescribecommand will output something like:
- now to run the backend run .
kubectl apply -f ./backend-k8s/deployment.ymlNote: this too is gona take a while you can go and take a cup of tea while you wait 😄.
after it have finished you can comfirm that it is indeed running by running .
kubectl get podsyou should be able to see backend-yolo- desplayed like this.
- now that the backend pod is running you can now run the backend service by running .
kubectl apply -f ./backend-k8s/service.ymlto confirm that our service is running run .
kubctl get serviceit will output something like this .

now that the backend service is done lets run the front end.
now that we are at the last part 😜 run.
kubectl apply -f ./frontend-k8s/deployment.yml and the service
kubectl apply -f ./frontend-k8s/service.yml confirming is the same as for the backend and will output an almost identical to that of the backend. if you see this .
thats means you are good to go 🧑🦯➡️.
For the people how feel like typing is taking to much like i , i have a solution for you guys i have created a automation python file called automation.py in the main branch .
so for automating the whole process run.
python3 automation.pythis python file gona do all for you guys
If you'd like to collaborate, have questions, or just want to get in touch, feel free to reach out to me!
- 0798190943
- josphat.rashid@student.moringaschool.com
I'm open to collaboration opportunities, feedback, and general inquiries!






