Advertisement
fornakter

mongo.yaml

Feb 2nd, 2025
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.96 KB | None | 0 0
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4.   name: mongodb-deployment
  5.   labels:
  6.     app: mongodb
  7. spec:
  8.   replicas: 1
  9.   selector:
  10.     matchLabels:
  11.       app: mongodb
  12.   template:
  13.     metadata:
  14.       labels:
  15.         app: mongodb
  16.     spec:
  17.       containers:
  18.         - name: mongodb
  19.           image: mongo
  20.           ports:
  21.             - containerPort: 27017
  22.           env:
  23.             - name: MONGO_INITDB_ROOT_USERNAME
  24.               valueFrom:
  25.                 secretKeyRef:
  26.                   name: mongodb-secret
  27.                   key: mongo-root-username
  28.             - name: MONGO_INITDB_ROOT_PASSWORD
  29.               valueFrom:
  30.                 secretKeyRef:
  31.                   name: mongodb-secret
  32.                   key: mongo-root-password
  33. ---
  34. apiVersion: v1
  35. kind: Service
  36. metadata:
  37.   name: mongodb-service
  38.   labels:
  39.     app: mongodb
  40. spec:
  41.   selector:
  42.     app: mongodb
  43.   ports:
  44.     - protocol: TCP
  45.       port: 27017
  46.       targetPort: 27017
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement