apiVersion: apps/v1 kind: Deployment metadata: name: mongo spec: replicas: 1 selector: matchLabels: app: mongo template: metadata: labels: app: mongo spec: hostAliases: - ip: "127.0.0.1" hostnames: - "mongo" securityContext: runAsUser: 1001 fsGroup: 0 containers: - name: mongo image: {{ .Values.mongo.image }} command: ["mongod"] args: ["--replSet", "{{ .Values.mongo.replSet }}"] ports: - containerPort: {{ .Values.mongo.port }} env: - name: MONGODB_REPLICA_SET_MODE value: primary - name: MONGODB_REPLICA_SET_NAME value: {{ .Values.mongo.replSet }} - name: MONGODB_ROOT_USER value: {{ .Values.mongo.rootUser | quote }} - name: MONGODB_ROOT_PASSWORD value: {{ .Values.mongo.rootPassword | quote }} - name: MONGODB_DATABASE value: {{ .Values.mongo.initDb | quote }} - name: MONGODB_REPLICA_SET_KEY value: {{ .Values.mongo.replSetKey | quote }} volumeMounts: - name: mongo-data mountPath: {{ .Values.mongo.volumeMounts.db }} - name: mongo-init mountPath: /docker-entrypoint-initdb.d/mongo-init.js subPath: mongo-init.js resources: requests: cpu: {{ .Values.resources.mongo.requests.cpu }} memory: {{ .Values.resources.mongo.requests.memory }} limits: cpu: {{ .Values.resources.mongo.limits.cpu }} memory: {{ .Values.resources.mongo.limits.memory }} volumes: - name: mongo-data persistentVolumeClaim: claimName: {{ .Values.persistence.mongoData }} - name: mongo-init configMap: name: mongo-init-script