创建 mongodb 副本集时出错 - 显示无法识别的选项“--smallfiles”

jer*_*ril 5 mongodb kubernetes kubernetes-statefulset

我正在创建下面的 mongodb statefulset,它创建了 3 个副本,但是当我运行代码时,我收到以下错误并且所有 pod 都处于 CrashLoopBackOff 状态。

这是我尝试 kubectl create -f 时得到的错误

Error parsing command line: unrecognised option '--smallfiles' 
Run Code Online (Sandbox Code Playgroud)
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
 name: mongo
 namespace: microservice1
spec:
 serviceName: "mongo"
 replicas: 3
 template:
   metadata:
     labels:
       role: mongo
       environment: test
   spec:
     terminationGracePeriodSeconds: 10
     containers:
       - name: mongo
         image: mongo
         command:
           - mongod
           - "--replSet"
           - rs0
           - "--smallfiles"
           - "--noprealloc"
         ports:
           - containerPort: 27017
         volumeMounts:
           - name: mongo-persistent-storage
             mountPath: /data/db
       - name: mongo-sidecar
         image: cvallance/mongo-k8s-sidecar
         env:
           - name: MONGO_SIDECAR_POD_LABELS
             value: "role=mongo,environment=test"
     volumes:
      - name: mongo-persistent-storage
        flexVolume:
          driver: rook.io/rook
          fsType: ceph
          options:
            fsName: myfs # name of the filesystem specified in the filesystem CRD.
            clusterNamespace: rook # namespace where the Rook cluster is deployed
            clusterName: rook

Run Code Online (Sandbox Code Playgroud)

FL3*_*3SH 9

--smallfiles在最新的 mongo (4.2) 中不受支持,您可以在doc 中检查它,您没有指定图像标签,因此latest在这种情况下是最新的mongo 4.2。

如果你设置image: mongo:4.0你的配置应该是正确的。