Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/j-sephb-lt-n/mongodb-with-admin-gui-in-k8s
Me learning kubernetes: Mongo-DB with Mongo-Express admin GUI in web browser
https://github.com/j-sephb-lt-n/mongodb-with-admin-gui-in-k8s
Last synced: about 22 hours ago
JSON representation
Me learning kubernetes: Mongo-DB with Mongo-Express admin GUI in web browser
- Host: GitHub
- URL: https://github.com/j-sephb-lt-n/mongodb-with-admin-gui-in-k8s
- Owner: J-sephB-lt-n
- License: gpl-3.0
- Created: 2024-01-20T12:44:08.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-01-25T06:50:34.000Z (10 months ago)
- Last Synced: 2024-04-17T22:57:30.999Z (7 months ago)
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mongodb-with-admin-gui-in-k8s
Me learning kubernetes: Mongo-DB with Mongo-Express admin GUI in web browserI got the starting code for this project from [this free kubernetes course](https://www.youtube.com/watch?v=X48VuDVv0do&t=2542s)
```mermaid
---
title: "my title"
---
flowchart LR
A["Browser
GUI"] --> B["External
service"]
B --> C["Mongo Express"]
C --> D["Internal
Service"]
D --> E["⛁
MongoDB
database"]
F["MongoDB
Secret
"] --> E
```Start [minikube](https://github.com/kubernetes/minikube) cluster:
```bash
~$ minikube start
``````bash
~$ kubectl get all
``````bash
~$ kubectl apply -f configs/mongodb-secret.yaml
``````bash
~$ kubectl get secret
``````bash
~$ kubectl apply -f configs/mongodb.yaml
``````bash
~$ kubectl get pod --watch --output wide
``````bash
~$ kubectl describe pod # copy pod name from "kubectl get pod" output
``````bash
~$ kubectl describe service mongodb-service
``````bash
~$ kubectl get all | grep mongodb
``````bash
# start interactive mongo shell inside mongodb container
~$ kubectl exec --stdin --tty -- mongosh --authenticationDatabase admin my-db-name
my-db-name> db.dogs.insertOne({"name":"brock", "breed":"pavement-special"})
MongoServerError: command insert requires authentication
my-db-name> use admin
switched to db admin
admin> db.auth("joe")
Enter password
whyAreYouDecodingThis
*********************{ ok: 1 }
admin> use my-db-name
switched to db my-db-name
my-db-name> db.dogs.insertOne({"name":"brock", "breed":"pavement-special"})
{
acknowledged: true,
insertedId: ObjectId('65b01a77abf089857b8825b3')
}
my-db-name> db.dogs.find({"name":"brock"})
[
{
_id: ObjectId('65b01a77abf089857b8825b3'),
name: 'brock',
breed: 'pavement-special'
}
]
my-db-name> exit
``````bash
~$ kubectl apply -f configs/mongo-configmap.yaml
``````bash
~$ kubectl apply -f configs/mongo-express.yaml
``````bash
~$ kubectl get service
``````bash
~$ kubectl get pod --watch --output wide
``````bash
~$ kubectl logs # get pod name from "kubectl get pod" output
``````bash
~$ minikube service mongo-express-service
``````bash
~$ minikube stop
``````bash
~$ minikue delete --all
```