Skip to content

Instantly share code, notes, and snippets.

@devendra-nationalwala
Created January 6, 2022 14:26
Show Gist options
  • Save devendra-nationalwala/a721c1096feec6b2550ef2492bf73b2e to your computer and use it in GitHub Desktop.
Save devendra-nationalwala/a721c1096feec6b2550ef2492bf73b2e to your computer and use it in GitHub Desktop.
mongo-db.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb-deployment
labels:
app: mongodb
spec:
replicas: 1
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo
ports:
- containerPort: 27017
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: mongodb-secret
key: mongo-root-username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-secret
key: mongo-root-password
---
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
selector:
app: mongodb
ports:
- protocol: TCP
port: 27017
targetPort: 27017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment