This guide explains how to deploy MongoDB and Mongo-Express on Minikube using Kubernetes manifests.
minikube delete --allminikube start --driver=dockerkubectl apply -f mongo.ymlkubectl apply -f mongo-express.ymlminikube service mongo-express-serviceThis will print a URL like:
http://127.0.0.1:30001
kubectl port-forward service/mongo-express-service 30001:8081Visit:
http://localhost:30001
kubectl get podskubectl get service
# or
kubectl get svckubectl get deploymentkubectl describe pod <pod-name>kubectl describe service mongo-express-servicekubectl describe deployment mongo-express-deployment- Use:
kubectl get pods -o wideto see node assignments and Pod IPs.
-
Minikube uses the Docker driver by default; you can change it if needed.
-
Production Warning:
Avoid storing passwords directly in YAML files.
Use Kubernetes Secrets:
kubectl create secret generic mongo-secret --from-literal=username=admin --from-literal=password=pass123