101 lines
2.1 KiB
YAML
101 lines
2.1 KiB
YAML
apiVersion: v1
|
|
data:
|
|
password: YWRtaW4K #admin this is base64 encoded, change with your choosing
|
|
username: YWRtaW4K #admin
|
|
kind: Secret
|
|
metadata:
|
|
name: mongo-creds
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: mongo-data
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 2Gi
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
labels:
|
|
app: mongo
|
|
name: mongo
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: mongo
|
|
strategy: {}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: mongo
|
|
spec:
|
|
containers:
|
|
- image: mongo:bionic
|
|
name: mongo
|
|
resources:
|
|
limits:
|
|
cpu: "500m" # 500 milliCPU
|
|
memory: "512Mi" # 512 Mebibytes
|
|
args: ["--dbpath","/data/db"]
|
|
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
|
|
env:
|
|
- name: MONGO_INITDB_ROOT_USERNAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mongo-creds
|
|
key: username
|
|
- name: MONGO_INITDB_ROOT_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mongo-creds
|
|
key: password
|
|
volumeMounts:
|
|
- name: "mongo-data-dir"
|
|
mountPath: "/data/db"
|
|
volumes:
|
|
- name: "mongo-data-dir"
|
|
persistentVolumeClaim:
|
|
claimName: "mongo-data"
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
labels:
|
|
app: mongo
|
|
name: mongo-service
|
|
spec:
|
|
ports:
|
|
- port: 27017
|
|
protocol: TCP
|
|
targetPort: 27017
|
|
selector:
|
|
app: mongo
|