The MongoDBSearch custom resource lets you deploy and configure MongoDB Search and Vector Search nodes alongside your MongoDB database deployments in Kubernetes. The MongoDBSearch resource deploys mongot processes that provide full-text and semantic search capabilities by syncing data from your MongoDB deployment.
To learn more about deploying MongoDB Search and Vector Search, see Deploy MongoDB Search and Vector Search.
Example
The following example shows a resource specification for a MongoDBSearch custom resource:
Note
This example is not a working configuration. It contains all available fields populated with sample values for reference. Some fields are mutually exclusive, and some take precedence over others (for example, source.external takes precedence over source.mongodbResourceRef). Refer to the field descriptions below for valid combinations.
1 spec: 2 source: 3 # external takes precedence over mongodbResourceRef 4 mongodbResourceRef: 5 name: mdb 6 external: 7 # hostAndPorts and shardedCluster are mutually exclusive 8 hostAndPorts: 9 - mdb-rs-external-0.example.com:27017 10 - mdb-rs-external-1.example.com:27017 11 - mdb-rs-external-2.example.com:27017 12 shardedCluster: 13 router: 14 hosts: 15 - mongos1.example.com:27017 16 - mongos2.example.com:27017 17 shards: 18 - shardName: shard-0 19 hosts: 20 - shard0-node1.example.com:27018 21 - shard0-node2.example.com:27018 22 - shardName: shard-1 23 hosts: 24 - shard1-node1.example.com:27018 25 - shard1-node2.example.com:27018 26 keyfileSecretRef: 27 name: mdb-keyfile 28 key: keyfile 29 tls: 30 # ca references a ConfigMap that contains ca.crt 31 ca: 32 name: mdbc-rs-ca 33 username: search-sync-source 34 passwordSecretRef: 35 name: mdbc-rs-search-sync-source-password 36 key: password 37 # x509 authentication (mutually exclusive with 38 # username/passwordSecretRef and source.tls) 39 x509: 40 clientCertificateSecretRef: 41 name: mongot-x509-client-cert 42 # Set only if the private key is encrypted 43 keyFilePasswordSecretRef: 44 name: mongot-x509-key-password 45 # TLS client certificate for SCRAM connections 46 # (mutually exclusive with x509): 47 # tls: 48 # clientCertificateSecretRef: 49 # name: mongot-scram-client-cert 50 # keyFilePasswordSecretRef: 51 # name: mongot-scram-key-password 52 security: 53 tls: 54 certificateKeySecretRef: 55 name: mdbs-tls-secret 56 certsSecretPrefix: my-prefix 57 # Set only if the private key is encrypted 58 keyFilePasswordSecretRef: 59 name: mdbs-tls-key-password 60 version: "1.70.1" 61 autoEmbedding: 62 embeddingModelAPIKeySecret: 63 name: embedding-model-api-query-key 64 providerEndpoint: https://ai.mongodb.com/v1/embeddings 65 featureFlags: 66 enableOverloadRetrySignal: true 67 logLevel: INFO 68 observability: 69 prometheus: 70 mode: enabled 71 port: 9946 72 metricsForwarder: 73 mode: auto 74 resourceRequirements: 75 requests: 76 cpu: 100m 77 memory: 128Mi 78 limits: 79 cpu: 250m 80 memory: 256Mi 81 deployment: 82 spec: 83 template: 84 spec: 85 nodeSelector: 86 kubernetes.io/os: linux 87 opsManager: 88 agentCredentials: 89 name: om-agent-api-key 90 projectConfigMapRef: 91 name: om-project-config 92 clusters: 93 - name: cluster-1 94 index: 0 95 replicas: 2 96 loadBalancer: 97 # Option 1: Operator-managed Envoy load balancer 98 managed: 99 externalHostname: "{shardName}.search.apps.example.com" 100 routerHostname: "search-router.apps.example.com:27028" 101 replicas: 2 102 resourceRequirements: 103 requests: 104 cpu: "100m" 105 memory: 128Mi 106 limits: 107 cpu: "500m" 108 memory: 512Mi 109 deployment: 110 spec: 111 template: 112 spec: 113 nodeSelector: 114 kubernetes.io/os: linux 115 retryPolicy: 116 numRetries: 2 117 perTryTimeout: "60s" 118 minMongotReadyReplicas: 1 119 # Option 2: User-provided (BYO) load balancer 120 # (mutually exclusive with managed) 121 unmanaged: 122 endpoint: "{shardName}-search-lb.corp.example.com:443" 123 resourceRequirements: 124 limits: 125 cpu: "3" 126 memory: 5Gi 127 requests: 128 cpu: "2" 129 memory: 4Gi 130 persistence: 131 single: 132 storage: 16G 133 storageClass: standard 134 statefulSet: 135 spec: 136 template: 137 spec: 138 nodeSelector: 139 kubernetes.io/os: linux 140 jvmFlags: 141 - -Xms2g 142 - -Xmx2g 143 advancedMongotConfigs: 144 someAdvancedSetting: value 145 syncSourceSelector: 146 matchTagSets: 147 - region: us-east-1 148 workload: search 149 - {} 150 shardOverrides: 151 - shardNames: 152 - shard-0 153 replicas: 3 154 resourceRequirements: 155 requests: 156 cpu: "4" 157 memory: 8Gi 158 persistence: 159 single: 160 storage: 32G 161 jvmFlags: 162 - -Xms4g 163 - -Xmx4g 164 statefulSet: 165 spec: 166 template: 167 spec: 168 nodeSelector: 169 disktype: ssd
Required MongoDBSearch Resource Settings
This section describes settings that you must use for all MongoDBSearch resources.
apiVersionType: string
Version of the MongoDB Kubernetes resource schema. Set the value to
mongodb.com/v1.
kindType: string
Kind of MongoDB Kubernetes resource to create. Set this to
MongoDBSearch.
metadata.namespaceType: string
Namespace where the
MongoDBSearchresource should be created. To leverage automatic configuration ofMongoDBSearchandMongoDBorMongoDBCommunityresources, theMongoDBSearchresource should be created in the same namespace as theMongoDBorMongoDBCommunityresource.
metadata.nameType: string
Unique identifier of the
MongoDBSearchresource. The name must be a valid Kubernetes DNS subdomain name. Keep the name short. The Kubernetes Operator derives the names of the Kubernetes resources it creates from it, for example{name}-search-{clusterIndex}-{shardName}. The Kubernetes Operator validates that every generated name fits within the Kubernetes DNS limits of 63 characters for labels and 253 characters for subdomain names.spec.clustersType: array of objects
Per-Kubernetes-cluster deployment configuration for the
MongoDBSearchresource. This field is required and must contain at least one entry and at most 50 entries: one entry for a single-cluster deployment, or one entry for each Kubernetes cluster that runsmongotpods in a multi-cluster deployment. For the full field reference, includingnameandindex, see Cluster Deployment Settings.
Optional MongoDBSearch Resource Settings
The MongoDBSearch custom resource can use the following settings:
Data Source Settings
spec.sourceType: object
Setting that describes the MongoDB source for
mongot. The source can be a replica set or a sharded cluster. This setting is required if:MongoDBis externalMongoDBhas a different name fromMongoDBSearch
The
MongoDBSearchresource must always be connected to a MongoDB deployment. If you deployed using the Kubernetes Operator withMongoDBorMongoDBCommunityCRD, and ifspec.sourceis empty, the Kubernetes Operator uses the following based on themetadata.nameto look for the database in Kubernetes:Find
MongoDBorMongoDBCommunityresources with the same name as set formetadata.nameinMongoDBSearch, in the same namespace.Find the password secret for the
mongotuser from the<MongoDBSearch.metadata.name>-<username>-passwordsecret, which for the default username yields<MongoDBSearch.metadata.name>-search-sync-source-password.
spec.source.mongodbResourceRef.nameType: string
Name of the
MongoDBorMongoDBCommunityresource to associate with this MongoDB Search and Vector Search resource. The Kubernetes Operator supports both replica sets and sharded clusters. You can't have more than oneMongoDBSearchresource referencing the sameMongoDBorMongoDBCommunityresource.Use this field only if your
MongoDBorMongoDBCommunityresource is deployed in the same Kubernetes cluster and is in the same namespace as yourMongoDBSearchresource. If your database is deployed outside of Kubernetes or is in a different namespace, usespec.source.externalto configure the connection to the database. If you set both fields,spec.source.externaltakes precedence.If omitted, the Kubernetes Operator looks for a
MongoDBorMongoDBCommunityresource with the same name as thisMongoDBSearchresource.spec.source.mongodbResourceRef.namespaceType: string
Namespace of the
MongoDBorMongoDBCommunityresource thatspec.source.mongodbResourceRef.namerefers to. The Kubernetes Operator currently ignores this field and always uses the namespace of theMongoDBSearchresource. Cross-namespace references are unsupported. If your database is in a different namespace, usespec.source.external.spec.source.usernameType: string
Username to use to authenticate
mongotwithmongod. The specified user must have thesearchCoordinatorrole. If omitted, the Kubernetes Operator assumes the username issearch-sync-source.spec.source.passwordSecretRef.nameType: string
Name of the secret that contains the password that
mongotmust use to authenticate withmongod. If omitted, defaults to<MongoDBSearch.metadata.name>-<username>-password, where<username>is the value ofspec.source.username. For the default usernamesearch-sync-source, this yields<MongoDBSearch.metadata.name>-search-sync-source-password.spec.source.passwordSecretRef.keyType: string
Key under which the password value is stored in the secret. If omitted, defaults to
password.
x509 Authentication Settings
spec.source.x509Type: object
Configures x509 client certificate authentication for the
mongotsync source connection. If you set this field,mongotauthenticates to MongoDB using x509 instead of username and password.This field is mutually exclusive with
spec.source.passwordSecretRef,spec.source.username, andspec.source.tls. The Kubernetes Operator rejects the configuration if you specify both x509 and password authentication.spec.source.x509.clientCertificateSecretRefType: object
Secret that contains the x509 client certificate and key for authenticating to the MongoDB sync source. The Secret must contain the following keys:
tls.crt— Client certificatetls.key— Private key
If the private key is encrypted with a password, store the password in a separate Secret and reference it with
spec.source.x509.keyFilePasswordSecretRef.You must specify this field if you set
spec.source.x509.spec.source.x509.keyFilePasswordSecretRefType: object
Secret that contains the password that decrypts the password-encrypted private key in
spec.source.x509.clientCertificateSecretRef. The Secret must contain the password under thekeyFilePasswordkey. Omit this field if the private key is not encrypted.
SCRAM TLS Client Certificate Settings
spec.source.tlsType: object
Configures a TLS client certificate for the
mongotsync source connection if you use SCRAM (username and password) authentication. If you set this field,mongotpresents the client certificate during the TLS handshake with the source MongoDB deployment (mutual TLS transport).mongotstill authenticates with the username and password.Use this field only with SCRAM authentication (
spec.source.passwordSecretRef). This field is mutually exclusive withspec.source.x509. If you want the client certificate itself to serve as the authentication credential, usespec.source.x509instead.spec.source.tls.clientCertificateSecretRefType: object
Secret that contains the TLS client certificate and key that
mongotpresents during the TLS handshake with the source MongoDB deployment. The Secret must contain the following keys:tls.crt— Client certificatetls.key— Private key
You must specify this field if you set
spec.source.tls.spec.source.tls.keyFilePasswordSecretRefType: object
Secret that contains the password that decrypts the password-encrypted private key in
spec.source.tls.clientCertificateSecretRef. The Secret must contain the password under thekeyFilePasswordkey. Omit this field if the private key is not encrypted.
External MongoDB Settings
spec.source.externalType: object
Settings that describe the external data source. Specify these settings only if you want to connect to an external MongoDB that wasn't deployed using the Kubernetes Operator. If you specify these settings, they take precedence over
spec.source.mongodbResourceRef.spec.source.external.hostAndPortsType: array of strings
List of hostnames and ports of the external replica set. This field is mutually exclusive with
spec.source.external.shardedCluster. UsehostAndPortsfor replica set sources andshardedClusterfor sharded cluster sources.spec.source.external.shardedClusterType: object
Declares an external sharded MongoDB cluster as the data source for
mongot. Contains configuration formongosrouters and per-shard replica set members.spec.source.external.shardedCluster.router.hostsType: array of strings
List of endpoints for the
mongosrouter instances inhost:portformat. Allmongotinstances connect to these routers. Specify at least one entry.spec.source.external.shardedCluster.shardsType: array of objects
List of all shards in the external MongoDB cluster. Each entry describes one shard's replica set. The Kubernetes Operator creates one
mongotStatefulSet for each shard. Specify at least one shard entry.spec.source.external.shardedCluster.shards[*].shardNameType: string
The logical name of the shard. The name must be unique across all shards and must conform to Kubernetes DNS label name rules (RFC 1123): lowercase alphanumeric characters and hyphens (
-), starting and ending with an alphanumeric character, with a maximum length of 63 characters. Periods (.) and underscores (_) are not allowed.The Kubernetes Operator combines
metadata.name, the cluster index, andshardNameinto the names of the Kubernetes resources it creates, and validates that every generated name fits within the Kubernetes DNS limits of 63 characters for labels and 253 characters for subdomain names. KeepshardNameshort enough for these limits.spec.source.external.shardedCluster.shards[*].hostsType: array of strings
List of endpoints of the
mongodreplica set members for this shard in thehost:portformat. Specify at least one entry. Each shard has its own group ofmongotinstances, which source data only from that shard's replica set.spec.source.external.keyfileSecretRefType: object
Secret that contains the
mongodkeyfile thatmongotuses to connect to the external MongoDB deployment. Thenamefield is required. Thekeyfield is optional.spec.source.external.tls.ca.nameType: string
Name of the ConfigMap containing the trusted chain of the certificate authorities that issued the TLS certificate used by the
mongodnodes. You must specify the certificate (or certificate chain) under theca.crtkey in this ConfigMap.
Cluster Deployment Settings
The following settings describe each entry of the required spec.clusters array.
spec.clustersType: array of objects
Per-Kubernetes-cluster deployment configuration for the
MongoDBSearchresource. This field is required and must contain at least one entry and at most 50 entries. All sizing and placement settings, such asreplicas,loadBalancer,resourceRequirements,persistence,jvmFlags, andstatefulSet, live inside aclustersentry. These settings have no top-level equivalents.For a single-cluster deployment, specify one entry. You can omit
nameandindex.For a multi-cluster deployment, specify one entry for each Kubernetes cluster that runs
mongotpods. If you specify more than one entry, the following rules apply:nameis required on every entry and must be unique.indexis required on every entry and must be unique.The MongoDB source must be external (
spec.source.external). Multi-cluster deployments don't support operator-managed MongoDB sources.Every entry must configure an operator-managed load balancer (
loadBalancer.managed). Multi-cluster deployments don't support unmanaged load balancers.
The Kubernetes Operator enforces these rules through CRD validation rules and reconcile-time validation.
spec.clusters[].nameType: string
Name of the Kubernetes cluster for this entry, with a maximum length of 253 characters. You can omit this field for a single-cluster deployment.
If
spec.clusterscontains more than one entry,nameis required, must be unique across entries, and can't change after you create the resource.spec.clusters[].indexType: integer
Stable integer identifier of the Kubernetes cluster for this entry. The value must be between
0and999, and must be unique across entries. Ifspec.clusterscontains more than one entry,indexis required on every entry.The Kubernetes Operator includes the index in the names of the Kubernetes resources it creates for this cluster entry, for example
{name}-search-{index}for StatefulSets,{name}-search-{index}-svcfor Services, and{name}-search-{index}-configfor ConfigMaps. For sharded cluster sources, the names also include the shard name, for example{name}-search-{index}-{shardName}and{name}-search-{index}-{shardName}-svc.Warning
Don't change the
indexof an existing entry. Because the index is part of the resource names, changing it causes the Kubernetes Operator to create new resources under the new index and orphan the resources at the old index. This applies to every index-bearing resource, including proxy Services ({name}-search-{index}[-{shardName}]-proxy-svc), the Envoy Deployment and ConfigMap ({name}-search-lb-{index}), load balancer certificate Secrets, and metrics forwarder resources ({name}-search-metrics-forwarder-{index}).For a single-cluster deployment, you can omit this field and it defaults to
0. However, if each member Kubernetes cluster runs its own Kubernetes Operator instance, setindexexplicitly to a distinct value in each cluster'sMongoDBSearchresource. Distinct indexes keep the generated hostnames and resource names from colliding across clusters.
Sizing and Storage
spec.clusters[].replicasType: integer
Number of
mongotpods to deploy in this Kubernetes cluster. For a replica set source, this is the total number ofmongotpods. For a sharded cluster source, this is the number ofmongotpods per shard.If
spec.clusters[].replicasis greater than1, you must also configurespec.clusters[].loadBalancerto route traffic betweenmongodand the multiplemongotinstances.If you set
spec.clusters[].replicasto0, the Kubernetes Operator takes themongotdeployment in this cluster offline. The Kubernetes Operator scales the StatefulSet to zero pods and keeps theMongoDBSearchresource and its other Kubernetes resources in place.If omitted, defaults to
1.spec.clusters[].resourceRequirementsType: core/v1/ResourceRequirements
CPU and memory that the
mongodb-searchcontainer can request and be limited to.If omitted, the Kubernetes Operator uses the following default values:
requests: cpu: 2 memory: 4Gi spec.clusters[].resourceRequirements.limitsType: object
Upper cap on the resource, CPU and memory, that the
mongodb-searchcontainer can consume. By default, there are no limits set.spec.clusters[].resourceRequirements.requestsType: object
Amount of CPU and memory requested for the
mongodb-searchcontainer. If you specify only one ofcpuormemory, the Kubernetes Operator applies the default value for the other.spec.clusters[].persistence.singleType: object
Storage configuration for MongoDB Search and Vector Search persistence volume where indexes are stored. Each search instance (pod) has its own independent storage.
ScalarData TypeDescriptionlabelSelectorstring
Tag used to bind mounted volumes to directories.
storagestring
Minimum size of Persistent Volume that should be mounted. Default value is
16G.storageClassstring
Type of storage specified in a Persistent Volume Claim.
MongoDBSearchsupports only thesinglepersistence mode, which uses one volume for all data. Although the CRD schema also contains aspec.clusters[].persistence.multiplefield, the Kubernetes Operator doesn't apply it. If you omitpersistence, the Kubernetes Operator setsspec.clusters[].persistence.single.storageto16G.
Load Balancing
spec.clusters[].loadBalancerType: object
Configuration for L7 load balancing between
mongod(ormongos) andmongot. This field is required ifspec.clusters[].replicasis greater than1.Exactly one of
managedorunmanagedmust be set.All entries in
spec.clustersmust agree on the load balancer mode: either every entry setsloadBalancer.managed, every entry setsloadBalancer.unmanaged, or no entry setsloadBalancer. The Kubernetes Operator rejects mixed modes. Multi-cluster deployments support only the managed mode.spec.clusters[].loadBalancer.managedType: object
Configures an operator-managed Envoy load balancer. This field is mutually exclusive with
spec.clusters[].loadBalancer.unmanaged.For sharded cluster sources, you must also configure
spec.security.tlsif you use a managed load balancer. The Envoy proxy routes traffic to the correct shard using SNI, which requires TLS.spec.clusters[].loadBalancer.managed.externalHostnameType: string
Hostname that the Envoy proxy expects for SNI matching on incoming requests. The Envoy TLS server certificate must include this hostname in its SAN (Subject Alternative Name) field.
For sharded cluster sources, the value must contain a
{shardName}placeholder, which the Kubernetes Operator expands per shard. Each shard gets its own hostname, and the Envoy TLS server certificate must include all expanded shard hostnames in its SANs. For replica set sources, don't use the{shardName}placeholder.This field is required if MongoDB is externally managed (not deployed by the Kubernetes Operator). If MongoDB is operator-managed in the same cluster, omit this field because the Kubernetes Operator auto-configures routing.
In multi-cluster deployments, each cluster entry typically uses a distinct hostname. However, the Kubernetes Operator permits sharing one hostname across clusters, for example if a failover proxy that spans availability zones fronts the Envoy proxies of multiple clusters.
spec.clusters[].loadBalancer.managed.routerHostnameType: string
Endpoint that
mongosrouters use to reach this cluster'smongotinstances through the managed Envoy load balancer, in thehost:portformat. The Kubernetes Operator uses the hostname for SNI matching on the cluster-level routing chain, so the Envoy TLS server certificate must include this hostname in its SANs.This field is required if you use a managed load balancer with an external sharded MongoDB source (
spec.source.external.shardedCluster). The Kubernetes Operator ignores this field for replica set sources and for operator-managed MongoDB.Unlike
externalHostname, the Kubernetes Operator uses this value verbatim, so the value must not contain a{shardName}placeholder. This endpoint is the shard-agnostic entry point formongos.spec.clusters[].loadBalancer.managed.replicasType: integer
Number of Envoy proxy pods to deploy in this Kubernetes cluster. The value must be
1or greater. If omitted, defaults to1.spec.clusters[].loadBalancer.managed.resourceRequirementsType: core/v1/ResourceRequirements
CPU and memory that the Envoy container can request and be limited to. If you specify this setting, the Kubernetes Operator replaces the defaults entirely.
If omitted, the Kubernetes Operator uses the following default values:
requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 512Mi spec.clusters[].loadBalancer.managed.deploymentType: object
Overrides that the Kubernetes Operator merges into the operator-created Envoy Deployment. This object contains a
metadatafield withlabelsandannotations, and aspecfield with an apps/v1/DeploymentSpec object.spec.clusters[].loadBalancer.managed.retryPolicyType: object
Retry behavior that the Envoy proxy applies to individual gRPC streams to the upstream
mongotinstances. The Envoy proxy sends each retry attempt to a differentmongothost than the failed attempt.If you omit this field, the Envoy proxy retries with the default values:
2retries with a per-try timeout of60s.spec.clusters[].loadBalancer.managed.retryPolicy.numRetriesType: integer
Maximum number of retries per request. The value must be
1or greater. If omitted, defaults to2, which allows three total attempts for each request.spec.clusters[].loadBalancer.managed.retryPolicy.perTryTimeoutType: string
Timeout for each individual attempt, including the original request, expressed as a duration string (for example,
"30s"). If omitted, defaults to"60s".spec.clusters[].loadBalancer.managed.minMongotReadyReplicasType: integer
Minimum number of ready
mongotreplicas that amongotgroup (for example, themongotinstances of one shard) must have before the Envoy proxy routes traffic to it. While a group is below this threshold, the Envoy proxy forwards the traffic intended for that group to a healthymongotgroup and marks the requests with therouted_from_another_shardheader. These requests return empty results instead of errors.The value must be
1or greater. If omitted, defaults to1.spec.clusters[].loadBalancer.unmanagedType: object
Configures a user-provided (Bring Your Own) L7 load balancer. This field is mutually exclusive with
spec.clusters[].loadBalancer.managed. Multi-cluster deployments don't support unmanaged load balancers.spec.clusters[].loadBalancer.unmanaged.endpointType: string
The endpoint of the BYO load balancer in
host:portformat. You must specify this field if you configurespec.clusters[].loadBalancer.unmanaged.If the Kubernetes Operator manages the MongoDB deployment (using
spec.source.mongodbResourceRef), the Kubernetes Operator writes this value into themongodconfiguration asmongotHostandsearchIndexManagementHostAndPort.For external sharded cluster sources, the value must contain a
{shardName}placeholder that the Kubernetes Operator expands per shard, and it must contain more than just the placeholder. For external replica set sources, the value must not contain a{shardName}placeholder.
Per-Shard Overrides
spec.clusters[].shardOverridesType: array of objects
Overrides that size specific shards within this cluster entry differently from the cluster defaults.
You can use this field only with an external sharded cluster source (
spec.source.external.shardedCluster). Each shard name that you reference must exist inspec.source.external.shardedCluster.shards[*].shardName, and you can override each shard at most once per cluster entry.Each override contains a required
shardNameslist (at least one entry) and optionalreplicas,resourceRequirements,persistence,jvmFlags, andstatefulSetfields. If you setreplicas,resourceRequirements,persistence, orjvmFlagsin an override, they replace the cluster value for the named shards.jvmFlagsreplaces the cluster value only if you set it to a non-empty list. The Kubernetes Operator deep-mergesstatefulSetonto the cluster value. Fields that you don't set inherit the cluster value.
Sync Source Selection
spec.clusters[].syncSourceSelector.matchTagSetsType: array of objects
Ordered list of replica set tag sets that selects the sync source
mongodnodes by their replica set tags. The Kubernetes Operator passes the list to themongotconfiguration.mongotsyncs from the nodes that the first matching tag set selects, and prefers secondary nodes.Each entry is a map of tag names to tag values. An empty document (
{}) matches any node, so you can append a trailing{}entry as a match-any fallback if no earlier tag set matches. You can specify at most 50 entries.
JVM Flags
spec.clusters[].jvmFlagsType: array of strings
JVM flags passed to the
mongotprocess. Each flag must start with-X,-XX:, or-D, must not contain spaces, and can contain only alphanumeric characters and the.,_,+,:,-, and=characters. The Kubernetes Operator rejects flags that don't match these rules.If you don't specify
-Xmsor-Xmxin this field, the Kubernetes Operator auto-calculates heap size by setting both to half ofspec.clusters[].resourceRequirements.requests.memory. If you don't specify resource requirements, the Kubernetes Operator uses a default of 4Gi memory request, yielding approximately-Xmx2048m -Xms2048m. The Kubernetes Operator always appends the flags you provide after the operator-computed flags.
StatefulSet Overrides
spec.clusters[].statefulSetType: object
Overrides for the StatefulSet that the Kubernetes Operator creates for deploying
mongotpods. This object contains ametadatafield withlabelsandannotations, and aspecfield with an apps/v1/StatefulSetSpec object. The Kubernetes Operator always applies the overrides last, so they overwrite the settings that the Kubernetes Operator computes.Note
Don't set resource requirements or persistence settings using
spec.clusters[].statefulSet. Instead, use thespec.clusters[].resourceRequirementsandspec.clusters[].persistencefields respectively.
Advanced mongot Settings
spec.clusters[].advancedMongotConfigsType: object
Advanced
mongotsettings for this cluster entry. The Kubernetes Operator renders the value verbatim under theadvancedConfigskey of themongotconfiguration file, without reading or modifying it. Use this field only formongotsettings that theMongoDBSearchresource doesn't expose as first-class fields.
Security Settings
spec.securityType: object
Security settings for
mongotlisten server.spec.security.tlsType: object
TLS settings for
mongot. If omitted,mongotwon't use TLS for incoming connections.If you use a managed load balancer with a sharded cluster source, this field is required. The Envoy proxy routes traffic to the correct shard using SNI, which depends on the TLS ClientHello. The Kubernetes Operator fails the reconcile if you omit
spec.security.tlsin this configuration.spec.security.tls.certificateKeySecretRef.nameType: string
Deprecated since version 1.8.0. : Use
spec.security.tls.certsSecretPrefixinstead.Name of the TLS secret in the same namespace containing the private key (
tls.key) and the certificate (tls.crt). The Kubernetes Operator still supports this field for replica set deployments for backwards compatibility. For sharded cluster deployments, the Kubernetes Operator rejects this field during validation because a single secret reference cannot cover per-shard certificates.spec.security.tls.certsSecretPrefixType: string
Prefix that the Kubernetes Operator uses to derive TLS secret names by naming convention. If you set this field, the Kubernetes Operator looks for secrets following these patterns:
ComponentSecret Name PatternReplica set's
mongotserver cert{certsSecretPrefix}-{name}-search-certSharded
mongotcert (per cluster and shard){certsSecretPrefix}-{name}-search-{clusterIndex}-{shardName}-certManaged load balancer server cert (per cluster, all topologies)
{certsSecretPrefix}-{name}-search-lb-{clusterIndex}-certManaged load balancer client cert
{certsSecretPrefix}-{name}-search-lb-{clusterIndex}-client-certThe Kubernetes Operator uses one managed load balancer server certificate per cluster for all topologies. For sharded clusters, the SANs of this certificate must include all expanded shard hostnames from
externalHostnameand therouterHostname.The Kubernetes Operator resolves the
mongotserver certificate secret name in the following order:If you set
spec.security.tls.certificateKeySecretRef.name, the Kubernetes Operator uses that name.If you set
certsSecretPrefix, the Kubernetes Operator uses the naming patterns in the preceding table.If you set neither field, the Kubernetes Operator uses the default name
{name}-search-certfor replica set deployments, or the default per-shard pattern{name}-search-{clusterIndex}-{shardName}-certfor sharded deployments.
If you don't set
certsSecretPrefix, the managed load balancer certificates also use default names: the Kubernetes Operator mounts{name}-search-lb-{clusterIndex}-certfor the server certificate and{name}-search-lb-{clusterIndex}-client-certfor the client certificate.spec.security.tls.keyFilePasswordSecretRefType: object
Secret that contains the password that decrypts the password-encrypted server private key in the TLS certificate secret. The Secret must contain the password under the
keyFilePasswordkey. Omit this field if the server private key is not encrypted.
Logging Settings
spec.logLevelType: string
Verbosity of the
mongotlogs. Value can be one of the following:TRACEDEBUGINFOWARNERROR
If omitted, defaults to
INFO.
Metrics Settings
spec.observability.prometheusType: object
Configuration for the Prometheus metrics endpoint in
mongot. If you omit this field, the Kubernetes Operator enables the metrics endpoint on the default port9946.spec.observability.prometheus.modeType: string
Enables or disables the Prometheus metrics endpoint in
mongot. Value can beenabledordisabled. If omitted, defaults toenabled.spec.observability.prometheus.portType: integer
Port on which to enable Prometheus metrics endpoint. By default, Prometheus metrics endpoint is enabled on port
9946.spec.observability.metricsForwarderType: object
Configuration for the metrics forwarder, a Deployment that the Kubernetes Operator creates to scrape the
mongotPrometheus metrics and forward them to Ops Manager.spec.observability.metricsForwarder.modeType: string
Whether the Kubernetes Operator creates the metrics forwarder. Value can be one of the following:
auto— The Kubernetes Operator creates the forwarder for operator-managedMongoDB(Ops Manager-backed) sources, and for external sources only if you setspec.observability.metricsForwarder.opsManager. ForMongoDBCommunitysources, the Kubernetes Operator doesn't create the forwarder.enabled— The Kubernetes Operator always creates the forwarder. If the source is aMongoDBCommunityresource, the Kubernetes Operator reports an error because the forwarder isn't supported forMongoDBCommunitysources.disabled— The Kubernetes Operator never creates the forwarder.
If omitted, defaults to
auto.The
enabledandautomodes require the Prometheus endpoint (spec.observability.prometheus) to be enabled. If you disable the endpoint, the Kubernetes Operator reports anInvalidmetrics forwarder status.spec.observability.metricsForwarder.resourceRequirementsType: core/v1/ResourceRequirements
CPU and memory that the metrics forwarder container can request and be limited to. If omitted, the Kubernetes Operator uses requests of
cpu: 100mandmemory: 128Mi, and limits ofcpu: 250mandmemory: 256Mi.spec.observability.metricsForwarder.deploymentType: object
Overrides that the Kubernetes Operator merges into the operator-created metrics forwarder Deployment. This object contains a
metadatafield withlabelsandannotations, and aspecfield with an apps/v1/DeploymentSpec object.spec.observability.metricsForwarder.opsManagerType: object
Ops Manager project and credentials that the metrics forwarder sends metrics to. If omitted, the Kubernetes Operator derives the project and credentials from the connection configuration of the source MongoDB resource. Set this field for external MongoDB sources, where no source MongoDB resource exists.
If you set this field, you must set both
agentCredentials.name(the Secret that contains the Ops Manager Agent API key) andprojectConfigMapRef.name(the ConfigMap that contains the Ops Manager project configuration).
Automated Embedding Settings
Important
Automated embedding is available as a Preview feature for only MongoDB Community Edition deployment. The feature and corresponding documentation might change at any time during the Preview period. To learn more, see Preview Features.
spec.autoEmbeddingType: object
Configuration for automated embedding for text data in your collection.
spec.autoEmbedding.embeddingModelAPIKeySecret.nameType: string
Name of the secret that contains the embedding model API keys that
mongotmust use to generate embeddings at index- and query-time. The Secret must contain the index-time key under theindexing-keykey and the query-time key under thequery-keykey.You can omit
embeddingModelAPIKeySecretonly ifspec.autoEmbedding.providerEndpointpoints to the operator-managed, self-hosted Voyage AI embedding service. Otherwise, the Kubernetes Operator requires it.spec.autoEmbedding.providerEndpointType: string
Embedding model endpoint URL for generating embeddings.
Feature Flag Settings
spec.featureFlagsType: object
Feature flags for
mongot. If you set a flag totrue, the Kubernetes Operator renders it into themongotconfiguration. If you omit thefeatureFlagsobject or an individual flag, the schema default for that flag applies (trueforenableOverloadRetrySignal).spec.featureFlags.enableOverloadRetrySignalType: boolean
Enables the
mongotoverload retry signal. If you enable this flag,mongotsignals load shedding to upstream proxies (such as the operator-managed Envoy load balancer) through gRPCRESOURCE_EXHAUSTEDresponses. The proxies then retry the request on anothermongotinstance.If omitted, defaults to
true.
Other Settings
spec.versionType: string
Version of the
mongodb-searchDocker image. If omitted, the Kubernetes Operator uses the default MongoDB Search version bundled with it. You can set the version explicitly to prevent automatic upgrades when you upgrade the Kubernetes Operator.
Status Fields
The Kubernetes Operator reports status information under the status field of the MongoDBSearch resource.
status.phaseType: string
Current phase of the
MongoDBSearchresource. Possible values includePending,Running,Failed,Disabled,Updated, andUnsupported.status.messageType: string
Human-readable message with details about the current status.
status.lastTransitionType: string
Timestamp of the last transition of
status.phase.status.observedGenerationType: integer
Generation of the
MongoDBSearchresource that the Kubernetes Operator last processed.status.warningsType: array of strings
Warnings that the Kubernetes Operator reports for the resource.
status.versionType: string
Version of MongoDB Search (
mongot) that the Kubernetes Operator reconciled.status.resourcesNotReadyType: array of objects
Dependent Kubernetes resources that are not yet ready. Each entry reports the
kindandnameof the resource and an optionalmessageand list oferrors.status.pvcType: array of objects
State of the persistent volume claims of the
mongotStatefulSets. Each entry reports thephaseand thestatefulsetNamethat the claims belong to.status.loadBalancerType: object
Status of the operator-managed load balancer (Envoy). This field is present only if you set
spec.clusters[].loadBalancer.managed. For multi-cluster deployments, the Kubernetes Operator reports the worst phase across the Envoy deployments of all clusters.status.loadBalancer.phaseType: string
Current phase of the managed load balancer. Possible values include
Pending,Running, andFailed. This field is visible inkubectl getoutput under theLOADBALANCERcolumn.status.loadBalancer.messageType: string
Human-readable message with details about the managed load balancer status.
status.metricsForwarderType: object
Status of the metrics forwarder.
status.metricsForwarder.phaseType: string
Current phase of the metrics forwarder. Possible values include
Pending,Running, andFailed. The phase reportsDisabledif you setspec.observability.metricsForwarder.modetodisabled. This field is visible inkubectl getoutput under theMETRICSFORWARDERcolumn.status.metricsForwarder.messageType: string
Human-readable message with details about the metrics forwarder status.