Skip to content

Instantly share code, notes, and snippets.

@alazycoder101
Created October 23, 2021 09:15
Show Gist options
  • Save alazycoder101/2ec9be8bf154a62988fe526f7fee1eff to your computer and use it in GitHub Desktop.
Save alazycoder101/2ec9be8bf154a62988fe526f7fee1eff to your computer and use it in GitHub Desktop.
mongo deployment in k8s
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongo
spec:
selector:
matchLabels:
role: mongo
environment: production
serviceName: "mongo"
replicas: 1
template:
metadata:
labels:
role: mongo
environment: production
spec:
terminationGracePeriodSeconds: 10
containers:
- name: mongo
image: mongo:3.4
command: ['bash']
args:
- '-c'
- |
mongod
ports:
- containerPort: 27017
volumeMounts:
- name: mongo-persistent-storage
mountPath: /data/db
volumeClaimTemplates:
- metadata:
name: mongo-persistent-storage
spec:
storageClassName: "standard"
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment