Files
rsop-k8s/cluster2/deployment-mongo2.yaml

62 lines
1.3 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: mongo2
namespace: cluster2
spec:
replicas: 1
selector:
matchLabels:
app: mongo2
template:
metadata:
labels:
app: mongo2
spec:
containers:
- name: mongo
image: mongo:7
ports:
- containerPort: 27017
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: cluster2-mongo-secret
key: MONGO_INITDB_ROOT_USERNAME
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: cluster2-mongo-secret
key: MONGO_INITDB_ROOT_PASSWORD
volumeMounts:
- name: data
mountPath: /data/db
- name: init-scripts
mountPath: /docker-entrypoint-initdb.d/init.js
subPath: mongo2-init.js
volumes:
- name: data
persistentVolumeClaim:
claimName: mongo2-data
- name: init-scripts
configMap:
name: cluster2-init-scripts
---
apiVersion: v1
kind: Service
metadata:
name: mongo2
namespace: cluster2
spec:
type: ClusterIP
selector:
app: mongo2
ports:
- name: mongo
port: 27017
targetPort: 27017