For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

Enable Authentication

The Kubernetes Operator supports X.509, LDAP, and SCRAM user authentication.

Note

For LDAP configuration, see the spec.security.authentication.agents.automationLdapGroupDN setting.

You must create an additional CustomResourceDefinition for your MongoDB users and the MongoDB Agent instances. The Kubernetes Operator generates and distributes the certificate.

See the full X.509 certificates configuration examples in the x509 Authentication directory in the Authentication samples directory. This directory also contains sample LDAP and SCRAM configurations.

apiVersion: mongodb.com/v1kind: MongoDBmetadata: name: my-tls-enabled-rsspec: type: ReplicaSet members: 3 version: "8.0.0" opsManager: configMapRef: name: my-configmap-name credentials: my-credentials security: tls: enabled: true authentication: enabled: true modes: ["X509"] internalCluster: "X509"
apiVersion: mongodb.com/v1kind: MongoDBUsermetadata: name: user-with-rolesspec: username: "CN=mms-user-1,OU=cloud,O=MongoDB,L=New York,ST=New York,C=US" db: "$external" mongodbResourceRef: name: my-resource roles: - db: "admin" name: "clusterAdmin"