minikube working
This commit is contained in:
81
k8s/base/mongodb.yaml
Normal file
81
k8s/base/mongodb.yaml
Normal file
@@ -0,0 +1,81 @@
|
||||
---
|
||||
# ── MongoDB Service ──
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mongodb
|
||||
namespace: ecommerce
|
||||
labels:
|
||||
app: mongodb
|
||||
app.kubernetes.io/part-of: ecommerce
|
||||
spec:
|
||||
clusterIP: None # Headless for StatefulSet
|
||||
ports:
|
||||
- port: 27017
|
||||
targetPort: 27017
|
||||
protocol: TCP
|
||||
name: mongodb
|
||||
selector:
|
||||
app: mongodb
|
||||
|
||||
---
|
||||
# ── MongoDB StatefulSet ──
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: mongodb
|
||||
namespace: ecommerce
|
||||
labels:
|
||||
app: mongodb
|
||||
app.kubernetes.io/part-of: ecommerce
|
||||
spec:
|
||||
serviceName: mongodb
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mongodb
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mongodb
|
||||
spec:
|
||||
containers:
|
||||
- name: mongodb
|
||||
image: mongo:7
|
||||
ports:
|
||||
- containerPort: 27017
|
||||
name: mongodb
|
||||
volumeMounts:
|
||||
- name: mongodb-data
|
||||
mountPath: /data/db
|
||||
resources:
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 1Gi
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: 27017
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- mongosh
|
||||
- --eval
|
||||
- "db.adminCommand('ping')"
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
failureThreshold: 5
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: mongodb-data
|
||||
spec:
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
Reference in New Issue
Block a user