Search code examples
mongodbkubernetesperconakubernetes-mongodb-sidecar

Add volume to mongoDB Percona operator


I'm trying to add Filebeat container to the rs0 StatefulSet to collect the logs of my mongoDB. I added a filebeat sidecar container to the operator (according to the docs), and now I'm stuck. How can I create an emptyDir volume that would be mounted and accessible on both the mongod container and the filebeat container?


Solution

  • The percona guys helped my find a solution, a bit of a hack but it worked for me

    you can't create a new volume for the mongod container but you can map one of the existing volumes to the sidecar container, for example:

    sidecars:
    - image: ...
      command: ...
      args: ...
      name: rs-sidecar-1
      volumeMounts:
        - mountPath: /mytmp
          name: mongod-data
    

    link for the original post on percona community forum