blob: 20021467078adafd302940360d11ce34a9fb0934 (
plain) (
tree)
|
|
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:4.4.10
livenessProbe:
exec:
command:
- mongo
- --disableImplicitSessions
- --eval
- "db.adminCommand('ping')"
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 6
readinessProbe:
exec:
command:
- mongo
- --disableImplicitSessions
- --eval
- "db.adminCommand('ping')"
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 6
command:
- mongod
- --config
- /etc/mongod.conf/mongod.conf
- --noauth
- --dbpath
- /data/db
- --bind_ip_all
ports:
- containerPort: 27017
- containerPort: 27018
- containerPort: 27019
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: mongodb-secrets
key: mongodb-root-username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-secrets
key: mongodb-root-password
volumeMounts:
- name: mongo-data
mountPath: /data/db
- name: mongo-conf
mountPath: /etc/mongod.conf
readOnly: true
volumes:
- name: mongo-data
persistentVolumeClaim:
claimName: mongo-data
- name: mongo-conf
configMap:
name: mongodb-config-file
---
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
selector:
app: mongodb
type: LoadBalancer
ports:
- protocol: TCP
name: "6617"
port: 27117
targetPort: 27017
nodePort: 30017
- protocol: TCP
name: "6618"
port: 27118
targetPort: 27018
nodePort: 30018
- protocol: TCP
name: "6619"
port: 27119
targetPort: 27019
nodePort: 30019
|