62 lines
1.4 KiB
YAML
62 lines
1.4 KiB
YAML
|
|
apiVersion: apps/v1
|
||
|
|
kind: StatefulSet
|
||
|
|
metadata:
|
||
|
|
name: mongodb
|
||
|
|
labels:
|
||
|
|
app: mongodb
|
||
|
|
spec:
|
||
|
|
serviceName: mongodb
|
||
|
|
replicas: 1
|
||
|
|
selector:
|
||
|
|
matchLabels:
|
||
|
|
app: mongodb
|
||
|
|
template:
|
||
|
|
metadata:
|
||
|
|
labels:
|
||
|
|
app: mongodb
|
||
|
|
spec:
|
||
|
|
containers:
|
||
|
|
- name: mongodb
|
||
|
|
image: mongo:7.0
|
||
|
|
imagePullPolicy: IfNotPresent
|
||
|
|
ports:
|
||
|
|
- name: mongodb
|
||
|
|
containerPort: 27017
|
||
|
|
envFrom:
|
||
|
|
- secretRef:
|
||
|
|
name: mongodb-secret
|
||
|
|
volumeMounts:
|
||
|
|
- name: mongodb-data
|
||
|
|
mountPath: /data/db
|
||
|
|
readinessProbe:
|
||
|
|
exec:
|
||
|
|
command:
|
||
|
|
- mongosh
|
||
|
|
- --eval
|
||
|
|
- "db.adminCommand('ping')"
|
||
|
|
initialDelaySeconds: 30
|
||
|
|
periodSeconds: 10
|
||
|
|
timeoutSeconds: 10
|
||
|
|
failureThreshold: 12
|
||
|
|
livenessProbe:
|
||
|
|
exec:
|
||
|
|
command:
|
||
|
|
- mongosh
|
||
|
|
- --eval
|
||
|
|
- "db.adminCommand('ping')"
|
||
|
|
initialDelaySeconds: 120
|
||
|
|
periodSeconds: 10
|
||
|
|
timeoutSeconds: 30
|
||
|
|
failureThreshold: 5
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
cpu: 100m
|
||
|
|
memory: 256Mi
|
||
|
|
limits:
|
||
|
|
cpu: 500m
|
||
|
|
memory: 512Mi
|
||
|
|
volumes:
|
||
|
|
- name: mongodb-data
|
||
|
|
persistentVolumeClaim:
|
||
|
|
claimName: mongodb-data
|