Skip to content

Commit

Permalink
Create Manifest.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jaiswaladi246 authored Feb 15, 2024
1 parent acb9d10 commit 45f9f09
Showing 1 changed file with 173 additions and 0 deletions.
173 changes: 173 additions & 0 deletions Manifest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@

---
apiVersion: v1
kind: PersistentVolume
metadata:
name: mongo-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: /home/ubuntu/mongo/mongo-vol

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongo-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

---
apiVersion: v1
kind: Secret
metadata:
name: mongodb-secret
type: Opaque
data:
username: YWRtaW4=
password: MTIz

---
apiVersion: v1
kind: Secret
metadata:
name: mongo-express-secret
type: Opaque
data:
mduser: YWRtaW4=
mdpass: MTIz
meuser: YWRtaW4=
mepass: MTIz

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb
labels:
app: mongodb
spec:
replicas: 1
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo
ports:
- containerPort: 27017
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: mongodb-secret
key: username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-secret
key: password
volumeMounts:
- name: mongo-data
mountPath: /data/db
volumes:
- name: mongo-data
persistentVolumeClaim:
claimName: mongo-pvc

---
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
selector:
app: mongodb
ports:
- protocol: TCP
port: 27017
targetPort: 27017

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

---
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
image: mongo-express
ports:
- containerPort: 8081
env:
- name: ME_CONFIG_BASICAUTH_USERNAME
valueFrom:
secretKeyRef:
name: mongo-express-secret
key: meuser
- name: ME_CONFIG_BASICAUTH_PASSWORD
valueFrom:
secretKeyRef:
name: mongo-express-secret
key: mepass
- name: ME_CONFIG_MONGODB_ADMINUSERNAME
valueFrom:
secretKeyRef:
name: mongodb-secret
key: username
- name: ME_CONFIG_MONGODB_ADMINPASSWORD
valueFrom:
secretKeyRef:
name: mongodb-secret
key: password
- name: ME_CONFIG_MONGODB_SERVER
valueFrom:
configMapKeyRef:
name: mongodb-configmap
key: db_host

---
apiVersion: v1
kind: Service
metadata:
name: mongo-express-service
spec:
selector:
app: mongo-express
type: NodePort
ports:
- protocol: TCP
port: 8081
targetPort: 8081

0 comments on commit 45f9f09

Please sign in to comment.