apiVersion: v1 kind: ConfigMap metadata: name: mongo-config namespace: uen labels: app: mongo data: mongodb.conf: |- dbpath=/data/middleware-data/mongodb logpath=/data/middleware-data/mongodb/mongodb.log pidfilepath=/data/middleware-data/mongodb/master.pid directoryperdb=true logappend=true bind_ip=0.0.0.0 port=27017 auth=true --- apiVersion: v1 kind: Service metadata: name: mongo-nodeport namespace: uen labels: app: mongo spec: type: NodePort ports: - name: mongo port: 27017 targetPort: 27017 selector: app: mongo --- apiVersion: apps/v1 kind: StatefulSet metadata: name: mongo namespace: uen labels: app: mongo spec: replicas: 1 selector: matchLabels: app: mongo template: metadata: annotations: app_name: mongo-mpos-test prometheus.com/scheme: http prometheus.com/path: /metrics prometheus.com/scraped: "true" prometheus.com/port: "9216" labels: app: mongo spec: containers: - name: mongo #image: mongo:4.2.3 image: harbor.uenpay.com/base/mongo:4.2.3 #image: registry.cn-hangzhou.aliyuncs.com/zhengyu1992/mongo:4.2.3 command: - sh - -c - "exec mongod -f /etc/mongod.conf" ports: - containerPort: 27017 resources: limits: cpu: 2 memory: 8Gi requests: cpu: 1 memory: 2Gi livenessProbe: initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 successThreshold: 1 failureThreshold: 3 tcpSocket: port: 27017 readinessProbe: initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 successThreshold: 1 failureThreshold: 3 tcpSocket: port: 27017 volumeMounts: - name: data mountPath: /data/middleware-data/mongodb/ - name: config mountPath: /etc/mongod.conf subPath: mongodb.conf - name: localtime readOnly: true mountPath: /etc/localtime - name: mongo-exporter image: harbor.uenpay.com/base/mongo-exporter:0.10.0 #image: registry.cn-hangzhou.aliyuncs.com/zhengyu1992/mongo-exporter:0.10.0 args: - '--collect.database' - '--collect.collection' - '--collect.topmetrics' - '--collect.indexusage' - '--collect.connpoolstats' env: - name: MONGODB_URI value: 'mongodb://admin:admin@mongo-0:27017' resources: requests: cpu: 100m memory: 100Mi limits: cpu: 100m memory: 100Mi ports: - containerPort: 9216 volumes: - name: config configMap: name: mongo-config - name: localtime hostPath: type: File path: /etc/localtime volumeClaimTemplates: - metadata: name: data annotations: volume.beta.kubernetes.io/storage-class: "cephfs-sc" spec: accessModes: - ReadWriteOnce resources: requests: storage: 30Gi