Skip to content

Instantly share code, notes, and snippets.

@shawnho1018
Created September 6, 2022 06:10
Show Gist options
  • Save shawnho1018/1ab8e4be1a6790a0915da88ec8fa06a3 to your computer and use it in GitHub Desktop.
Save shawnho1018/1ab8e4be1a6790a0915da88ec8fa06a3 to your computer and use it in GitHub Desktop.
---
apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
name: example-mongodb
namespace: mongodb
spec:
members: 3
type: ReplicaSet
version: "4.2.6"
security:
authentication:
modes: ["SCRAM"]
users:
- name: my-user
db: admin
passwordSecretRef: # a reference to the secret that will be used to generate the user's password
name: my-user-password
roles:
- name: clusterAdmin
db: admin
- name: userAdminAnyDatabase
db: admin
- name: readWriteAnyDatabase
db: admin
scramCredentialsSecretName: my-scram
additionalMongodConfig:
storage.wiredTiger.engineConfig.journalCompressor: zlib
# the user credentials will be generated from this secret
# once the credentials are generated, this secret is no longer required
---
apiVersion: v1
kind: Secret
metadata:
name: my-user-password
namespace: mongodb
type: Opaque
stringData:
password: [your-password]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment