You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1008 B
YAML

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