This is my first K8s project. I made this to get some hands-on experience in Kubernetes and expand my knowledge in container orchestration.
- Clone the repository
git clone https://github.com/0xt3j4s/k8s-mongo-project.git
- Start minikube
minikube start
- Create the secret
kubectl apply -f mongo-secret.yaml
- Create the mongodb deployment and the internal service
kubectl apply -f mongo.yaml
- Check the status
kubectl get all
- Create the configmap
kubectl apply -f mongo-configmap.yaml
- Create the mongo express pod and the external service
kubectl apply -f mongo-express.yaml
- Check the status
kubectl get all
kubectl get service
- Open the mongo express service
minikube service mongo-express-service
This is will generate the URL to access the mongo express service at the assigned nodePort
(which is 30001 in this case).
- Open the URL in your browser and you will see the mongo express UI.
-
Created the secret:
$ kubectl apply -f mongo-secret.yaml secret/mongo-secret created
-
Confirmed using:
$ kubectl get secret NAME TYPE DATA AGE mongo-secret Opaque 2 15s
-
Creating the mongodb deployment
$ kubectl apply -f mongo.yaml deployment.apps/mongo-deployment created
-
Confirmed using:
$ kubectl get pod NAME READY STATUS RESTARTS AGE mongo-deployment-845bcbf466-8v6bd 1/1 Running 0 48s
-
Creating the internal service
$ kubectl apply -f mongo.yaml deployment.apps/mongo-deployment unchanged service/mongodb-service created
Similarly Created the configmap and the mongo express pod and the external service.
-
configmap:
$ kubectl apply -f mongo-configmap.yaml configmap/mongodb-configmap created
-
Mongo express pod:
$ kubectl apply -f mongo-express.yaml deployment.apps/mongo-express created
-
External service:
$ kubectl apply -f mongo-express.yaml deployment.apps/mongo-express unchanged service/mongo-express-service created
Finally, opening the mongo express external service using minikube
minikube service mongo-express-service
|-----------|-----------------------|-------------|---------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|-----------------------|-------------|---------------------------|
| default | mongo-express-service | 8081 | http://192.168.49.2:30001 |
|-----------|-----------------------|-------------|---------------------------|
🎉 Opening service default/mongo-express-service in default browser...