46 lines
1.0 KiB
YAML
46 lines
1.0 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: mongodb
|
|
namespace: database
|
|
spec:
|
|
serviceName: mongodb
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: mongodb
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: mongodb
|
|
spec:
|
|
containers:
|
|
- name: mongodb
|
|
image: mongo:7
|
|
ports:
|
|
- containerPort: 27017
|
|
volumeMounts:
|
|
- name: mongodb-data
|
|
mountPath: /data/db
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- mongosh
|
|
- --eval
|
|
- "db.adminCommand('ping')"
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
failureThreshold: 6
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- mongosh
|
|
- --eval
|
|
- "db.adminCommand('ping')"
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
volumes:
|
|
- name: mongodb-data
|
|
persistentVolumeClaim:
|
|
claimName: mongodb-pvc
|