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.

Kubernetes Operator kubectl and oc Installation Settings

To provide optional settings, edit the YAML file that corresponds to your deployment type in the directory where you cloned the Kubernetes Operator repository:

  • Vanilla Kubernetes using kubectl: mongodb-kubernetes.yaml

  • OpenShift using oc: mongodb-kubernetes-openshift.yaml

If the setting that you want to add doesn't exist in the YAML file, add it as a new array of key-value pair mappings in the spec.template.spec.containers.name.env. collection:

  • Set the value of the spec.template.spec.containers.name.env.name key to the setting's name.

  • Set the value of the spec.template.spec.containers.name.env.value key to the setting's value.

To fill in values for container images, see Container Images.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: INIT_DATABASE_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-database

URL of the repository from which the Kubernetes Operator downloads the MongoDB Agent image for non-static database deployments. Include the MongoDB Agent version. To learn more, see Plan Your Kubernetes Operator Container Images.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: AGENT_IMAGE value: quay.io/mongodb/mongodb-agent:<version>

Time, in seconds, the Kubernetes Operator attempts to connect to a cluster's Kubernetes API server endpoint. This timeout is set for all Kubernetes clusters in multi-Kubernetes cluster MongoDB deployments. If the Kubernetes Operator doesn't get a response from the Kubernetes API server within the specified time, it logs the cluster's status as "unhealthy". To learn more, see Troubleshooting Kubernetes Clusters.

The default value is 10.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: CLUSTER_CLIENT_TIMEOUT value: 10

Version of the MongoDB Enterprise Database image that the Kubernetes Operator deploys.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: DATABASE_VERSION value: 1.15.0

Pull policy for the MongoDB Enterprise database image the Kubernetes Operator deploys.

The Kubernetes Operator accepts the following values: Always, IfNotPresent, Never.

The default value is Always.

URL of the repository from which the initContainer image that contains the MongoDB Agent start-up scripts and the readiness probe is downloaded.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: INIT_DATABASE_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-database

Version of the initContainer image that contains the MongoDB Agent start-up scripts and the readiness probe.

The default value is 1.15.0.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: INIT_DATABASE_VERSION value: 1.15.0

URL of the repository from which the initContainer image that contains the Ops Manager start-up scripts and the readiness probe is downloaded.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: INIT_OPS_MANAGER_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-ops-manager

Version of the initContainer image that contains the Ops Manager start-up scripts and the readiness probe.

The default value is 1.15.0.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: INIT_OPS_MANAGER_VERSION value: 1.15.0

Path to the rotated readiness.log backup files maintained by the Readiness Probe.

The default value is /var/log/mongodb-mms-automation/readiness.log.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: LOG_FILE_PATH value: /var/log/mongodb-mms-automation/readiness.log

Flag that determines whether or not the Kubernetes Operator inherits the securityContext settings that your Kubernetes cluster manages.

This value must be true if you want to run the Kubernetes Operator in OpenShift or in a restrictive environment.

The default value is false.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: MANAGED_SECURITY_CONTEXT value: false

URL of the repository from which the Kubernetes Operator downloads the MongoDB Agent image for database deployments. To learn more, see Plan Your Kubernetes Operator Container Images.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: MDB_AGENT_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-agent

The default value is false, which automatically updates the image suffix.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: MDB_APPDB_ASSUME_OLD_FORMAT value: false

Flag that determines whether or not the Kubernetes Operator enables automatic recovery for MongoDB resources per Pod.

The default value is true.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: MDB_AUTOMATIC_RECOVERY_ENABLE value: false

Number of seconds that a custom resource can remain in a Pending or Failed state before the Kubernetes Operator automatically recovers your MongoDB resources.

The default value is 1200 seconds (20 minutes).

To disable automatic recovery, set the MDB_AUTOMATIC_RECOVERY_ENABLE environment variable to false.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: MDB_AUTOMATIC_RECOVERY_BACKOFF_TIME_S value: 3600

Determines the container architecture used by all your deployments:

To enable static containers for a single deployment, use metadata.annotations.mongodb.com/v1.architecture in the MongoDB resource instead.

The default is non-static.

To enable static containers, set to static.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: MDB_DEFAULT_ARCHITECTURE value: static

Determines the default variant of the mongodb-enterprise-server image for all deployments that use Static Containers (Public Preview) and for the Application Database.

Accepted values are:

  • ubi8

  • ubi9

  • ubi9-slim

When unset, deployments that use static containers use ubi9, and a non-static Application Database uses ubi8.

To set the image variant for a single deployment, use metadata.annotations.mongodb.com/v1.containerImageType in the MongoDB resource instead. The annotation takes precedence over this setting.

If you set an unsupported value, the Kubernetes Operator ignores the value and logs a warning.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: MDB_DEFAULT_IMAGE_TYPE value: ubi9-slim

Controls whether log files are output to standard output, such as when you run kubectl describe.

The default is true.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: MDB_WITH_AGENT_FILE_LOGGING value: true

The number of concurrent reconciliation processes the Kubernetes Operator can perform.

Example

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - env: - name: MDB_MAX_CONCURRENT_RECONCILES value: "10"

Enables the Kubernetes Operator to collect and send telemetry to MongoDB for analysis. MDB_OPERATOR_TELEMETRY_SEND_ENABLED must also be set to true for the Kubernetes Operator to send telemetry to MongoDB.

The default is true. If set to false, the Kubernetes Operator doesn't collect or send telemetry to MongoDB.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - env: - name: MDB_OPERATOR_TELEMETRY_ENABLED value: "true"

Enables the Kubernetes Operator to send telemetry to MongoDB for analysis. MDB_OPERATOR_TELEMETRY_ENABLED must also be set to true for the Kubernetes Operator to send telemetry.

The default is true. If set to false, the Kubernetes Operator collects telemetry in the ConfigMap named mongodb-kubernetes-operator-telemetry, but doesn't send it to MongoDB.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - env: - name: MDB_OPERATOR_TELEMETRY_SEND_ENABLED value: "true"

Enables the Kubernetes Operator to function in proxy-restricted environments. Set this variable to true with the standard proxy settings (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) to propagate these proxy settings from your Kubernetes Operator Pod to the MongoDB Agents, allowing all components to communicate effectively through the specified proxies.

Example

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - env: - name: MDB_PROPAGATE_PROXY_ENV value: "true" - name: HTTP_PROXY value: "http://example-http-proxy:7312" - name: HTTPS_PROXY value: "https://secure-proxy:3242" - name: NO_PROXY value: "google.com"

URL of the MongoDB Enterprise Database image that the Kubernetes Operator deploys.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: MONGODB_ENTERPRISE_DATABASE_IMAGE value: quay.io/mongodb/mongodb-kubernetes-database

URL of the base repository for official MongoDB server images.

The default value is quay.io/mongodb.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: MONGODB_REPO_URL value: quay.io/mongodb

Label for the Kubernetes Operators deployment environment. This value affects the default timeouts and the logging level and format:

If the value is
Log Level is set to
Log Format is set to

dev

debug

text

prod

info

json

The default value is prod.

Pull policy for the Ops Manager images the Kubernetes Operator deploys.

The Kubernetes Operator accepts the following values: Always, IfNotPresent, and Never.

The default value is Always.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: OPS_MANAGER_IMAGE_PULL_POLICY value: Always

URL of the repository from which the image for an Ops Manager resource is downloaded.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: OPS_MANAGER_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-enterprise-ops-manager-ubi

The number of rotated readiness.log backup files maintained by the Readiness Probe.

The default value is 5.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: READINESS_PROBE_LOGGER_BACKUPS value: 1

Controls whether the rotated readiness.log backup files maintained by the Readiness Probe are compressed to readiness.log.gz files.

The default value is false, which leaves the readiness.log files uncompressed.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: READINESS_PROBE_LOGGER_COMPRESS value: true

The maximum size of the readiness.log file in MB.

The default value is 100.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: READINESS_PROBE_LOGGER_MAX_SIZE value: 125

The maximum number of days to retain rotated readiness.log files, starting with the date in the file timestamp. If set to 0, the Kubernetes Operator doesn't remove readiness.log files on the basis of age, instead relying on READINESS_PROBE_LOGGER_BACKUPS to determine retention.

The default value is 0.

spec: template: spec: serviceAccountName: mongodb-kubernetes-operator containers: - name: mongodb-kubernetes-operator image: <operatorVersionUrl> imagePullPolicy: <policyChoice> env: - name: READINESS_PROBE_LOGGER_MAX_AGE value: 3

Namespaces that the Kubernetes Operator watches for MongoDB resource changes. If this namespace differs from the default, ensure that the Kubernetes Operator ServiceAccount can access this namespace.

  • To watch all namespaces, specify * and assign the ClusterRole to the mongodb-kubernetes-operator ServiceAccount that you use to run the Kubernetes Operator.

  • To watch a subset of all namespaces, specify them in a comma-separated list, escape each comma with a backslash, and surround the list in quotes, such as "operator.watchNamespace=ns1\,ns2".

Watching a subset of namespaces is useful in deployments where a single Kubernetes Operator instance watches a different cluster resource type. For example, you can configure the Kubernetes Operator to watch MongoDB resources in one subset of namespaces, and to watch MongoDBMultiCluster resources in another subset of namespaces. To avoid race conditions during resource reconciliation, for each custom resource type that you want the Kubernetes Operator to watch, ensure that you set scope to a distinct subset of namespaces.

Important

To deploy Ops Manager and MongoDB resources to one or more namespaces other than the one where you deploy the Kubernetes Operator, see Set Scope for MongoDB Controllers for Kubernetes Operator Deployment for values you must use and additional steps you might have to perform.

The default value is <metadata.namespace>.

Rate this page