Created
January 31, 2025 15:02
-
-
Save sibelius/5bf1a2e0a15997e3faa1810828b5aec8 to your computer and use it in GitHub Desktop.
basic mongodb k8s deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
name: mongodb1 | |
name: mongodb1 | |
namespace: woovi-mongo-dev | |
spec: | |
replicas: 1 | |
strategy: | |
type: Recreate | |
selector: | |
matchLabels: | |
name: mongodb1 | |
mongo: node | |
template: | |
metadata: | |
labels: | |
name: mongodb1 | |
mongo: node | |
spec: | |
hostname: mongodb1 | |
containers: | |
- image: mongo:7.0.2 | |
name: mongo | |
command: | |
- mongod | |
- "--replSet" | |
- rs0 | |
- "--bind_ip_all" | |
ports: | |
- name: mongodb | |
containerPort: 27017 | |
resources: | |
requests: | |
cpu: 1500m | |
memory: 9Gi | |
livenessProbe: | |
exec: | |
command: | |
- mongosh | |
- --eval | |
- "db.adminCommand('ping')" | |
initialDelaySeconds: 180 | |
periodSeconds: 300 | |
timeoutSeconds: 10 | |
volumeMounts: | |
- name: mongo-storage | |
mountPath: /data/db | |
volumes: | |
- name: mongo-storage | |
persistentVolumeClaim: | |
claimName: mongo1-persistent-storage | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
namespace: woovi-mongo-dev | |
labels: | |
name: mongodb1 | |
name: mongodb1 | |
spec: | |
ports: | |
- port: 27017 | |
targetPort: 27017 | |
selector: | |
name: mongodb1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: mongo1-persistent-storage | |
namespace: woovi-mongo-dev | |
spec: | |
storageClassName: "microk8s-hostpath" | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 10Gi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just copy and paste N number of MongoDB deployments