0% found this document useful (0 votes)
6 views3 pages

MongoDB Deployment and Configuration Guide

The document contains Kubernetes configuration files for deploying a MongoDB database and a Mongo Express web interface. It includes a ConfigMap for database URL, a Secret for sensitive credentials, and Deployments for both MongoDB and Mongo Express with their respective Services. The configurations enable secure access and management of the MongoDB instance through the web interface.

Uploaded by

iamazurecloud
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

MongoDB Deployment and Configuration Guide

The document contains Kubernetes configuration files for deploying a MongoDB database and a Mongo Express web interface. It includes a ConfigMap for database URL, a Secret for sensitive credentials, and Deployments for both MongoDB and Mongo Express with their respective Services. The configurations enable secure access and management of the MongoDB instance through the web interface.

Uploaded by

iamazurecloud
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Configmap.

yaml

apiVersion: v1
kind: ConfigMap
metadata:
name: mongodb-configmap
data:
database_url: mongodb-service

[Link]

apiVersion: v1
kind: Secret
metadata:
name: mongodb-secret
type: Opaque
data:
mongo-root-username: dXNlcm5hbWU=
mongo-root-password: cGFzc3dvcmQ=
mongo-web-username: YWRtaW4=
mongo-web-password: YWRtaW4xMjM0NTY3ODkxMA==

Mongo [Link]

apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb-deployment
labels:
app: mongodb
spec:
replicas: 1
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo
ports:
- containerPort: 27017

Website: [Link] YouTube: [Link]


WhatsApp: +91 73309 77091, Email: charan@[Link]
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: mongodb-secret
key: mongo-root-username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-secret
key: mongo-root-password
#resources:
---
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
selector:
app: mongodb
ports:
- protocol: TCP
port: 27017
targetPort: 27017

Mongo-express [Link]

apiVersion: apps/v1
kind: Deployment
metadata:
name: mongo-express
labels:
app: mongo-express
spec:
replicas: 1
selector:
matchLabels:
app: mongo-express
template:
metadata:
labels:
app: mongo-express
spec:
containers:
- name: mongo-express

Website: [Link] YouTube: [Link]


WhatsApp: +91 73309 77091, Email: charan@[Link]
image: mongo-express
ports:
- containerPort: 8081
env:
- name: ME_CONFIG_MONGODB_ADMINUSERNAME
valueFrom:
secretKeyRef:
name: mongodb-secret
key: mongo-root-username
- name: ME_CONFIG_MONGODB_ADMINPASSWORD
valueFrom:
secretKeyRef:
name: mongodb-secret
key: mongo-root-password
- name: ME_CONFIG_BASICAUTH_USERNAME
valueFrom:
secretKeyRef:
name: mongodb-secret
key: mongo-web-username
- name: ME_CONFIG_BASICAUTH_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-secret
key: mongo-web-password
- name: ME_CONFIG_MONGODB_SERVER
valueFrom:
configMapKeyRef:
name: mongodb-configmap
key: database_url
---
apiVersion: v1
kind: Service
metadata:
name: mongo-express-service
spec:
selector:
app: mongo-express
type: LoadBalancer
ports:
- protocol: TCP
port: 8081
targetPort: 8081
nodePort: 31000

Website: [Link] YouTube: [Link]


WhatsApp: +91 73309 77091, Email: charan@[Link]

You might also like