MongoDB K8s manifest
MongoDB K8s manifest
Here's a simple manifest to deploy MongoDB with data persistence in microk8s:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongo
namespace: my-namespace
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongo
namespace: my-namespace
spec:
replicas: 1
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
app: mongo
spec:
containers:
- name: mongo
image: mongo
imagePullPolicy: Always
ports:
- containerPort: 27017
volumeMounts:
- mountPath: "/data/db"
name: mongo
volumes:
- name: mongo
persistentVolumeClaim:
claimName: mongo
---
apiVersion: v1
kind: Service
metadata:
name: mongo
namespace: my-namespace
spec:
ports:
- port: 27017
selector:
app: mongo
type: ClusterIP