Hi everyone,
We’re trying to secure our MongoDB operator and cluster deployments using securityContext parameters. We have seen in the operator documentation and in the operator CRD that it is possible to use podSecurityContext, containerSecurityContext and securityContext.
We have managed to apply this security configuration to all Docker containers in the 3-node pods (operator, mongod, backup and our custom sidecar container running MongoDB exporter), except for the mongo-init container.
Can you please help us out configuring the securityContext properly, so that we can apply this to the init container as well?
Thanks in advance!
Current configuration:
Operator:
spec:
template:
spec:
containers:
securityContext:
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
MongoDB cluster:
spec:
replsets:
podSecurityContext:
runAsNonRoot: true
containerSecurityContext:
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
replsets:
securityContext:
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
backup:
securityContext:
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL