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

62 lines
1.3 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: mongo1
namespace: cluster2
spec:
replicas: 1
selector:
matchLabels:
app: mongo1
template:
metadata:
labels:
app: mongo1
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: mongo1-init.js
volumes:
- name: data
persistentVolumeClaim:
claimName: mongo1-data
- name: init-scripts
configMap:
name: cluster2-init-scripts
---
apiVersion: v1
kind: Service
metadata:
name: mongo1
namespace: cluster2
spec:
type: ClusterIP
selector:
app: mongo1
ports:
- name: mongo
port: 27017
targetPort: 27017