对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

Ops Manager 资源规范

MongoDB Controllers for Kubernetes Operator 根据您写入的规范文件创建容器化MongoDB Ops Manager部署。

创建或更新MongoDB Ops Manager资源规范后,您可以指示MongoDB Controllers for Kubernetes Operator 将此规范应用您的Kubernetes环境。 Kubernetes Operator 创建MongoDB Ops Manager所需的服务和自定义Kubernetes资源,然后在Kubernetes环境中的容器中部署MongoDB Ops Manager及其后端应用程序数据库。

每个MongoDB Ops Manager资源都使用 YAML 中的对象规范来定义部署的特征和设置。

以下示例显示了 Ops Manager 部署的资源规范:

1apiVersion: mongodb.com/v1
2kind: MongoDBOpsManager
3metadata:
4 name: om
5spec:
6 topology: SingleCluster # optional, SingleCluster by default
7 opsManagerURL: https://link.to.configured.load-balancer.example.com # optional OM URL for the operator
8replicas: 1
9version: "8.0.0"
10 adminCredentials: ops-manager-admin-secret
11 configuration:
12 mms.fromEmailAddr: admin@example.com
13 mms.security.allowCORS: "false"
14 security:
15 tls:
16 ca: issuer-ca
17 backup:
18 enabled: true
19 encryption:
20 kmip:
21 server:
22 url: kmip.corp.mongodb.com:5696
23 ca: mongodb-kmip-certificate-authority-pem
24 headDB:
25 storage: "30Gi"
26 labelSelector:
27 matchLabels:
28 app: my-app
29 opLogStores:
30 - name: oplog1
31 # Sets labels for the oplog store.
32 assignmentLabels: ["test1", "test2"]
33 mongodbResourceRef:
34 name: my-oplog-db
35 mongodbUserRef:
36 name: my-oplog-user
37 s3Stores:
38 - name: s3store1
39 # Sets labels for the S3 store.
40 assignmentLabels: ["test1", "test2"]
41
42 mongodbResourceRef:
43 name: my-s3-metadata-db
44 mongodbUserRef:
45 name: my-s3-store-user
46 s3SecretRef:
47 name: my-s3-credentials
48 pathStyleAccessEnabled: true
49 s3BucketEndpoint: s3.region.amazonaws.com
50 s3BucketName: my-bucket
51 applicationDatabase:
52 passwordSecretKeyRef:
53 name: om-db-user-secret
54 key: password
55 members: 3
56 topology: SingleCluster
57 version: "7.0.21-ubi8"
58 featureCompatibilityVersion: "6.0" # During upgrade, set this FCV value to your currently deployed AppDB version.
59 security:
60 certsSecretPrefix: appdb
61 tls:
62 ca: issuer-ca

本部分介绍必须用于所有 Ops Manager 资源的设置。

apiVersion

类型:字符串

必需。 MongoDB Kubernetes 资源模式的版本。

kind

类型:字符串

必需。 要创建的 MongoDB Kubernetes 资源类型。 将其设置为MongoDBOpsManager 。

metadata.name

类型:字符串

必需。 您正在创建的 MongoDB Kubernetes 资源的名称。

资源名称必须少于或等于 44 个字符。

spec.version

类型:字符串

必需。 要在此 MongoDB Kubernetes 资源上安装的 Ops Manager 版本。

spec.adminCredentials

类型:字符串

必需。您为MongoDB Ops Manager管理员用户创建的Kubernetes密钥的名称。当您部署MongoDB Ops Manager资源时, Kubernetes Operator 会使用这些凭证创建用户。

注意

为避免在单集群Kubernetes部署中存储密钥,您可以将所有密钥迁移到密钥存储工具。多个Kubernetes集群上的部署不支持将密钥存储在密钥存储工具中,例如 HashiCorp Vault 。

管理员用户被授予“全局所有者”角色。

spec.replicas

类型:整型

Conditional. Number of Ops Manager instances to run in parallel. If you specify SingleCluster in spec.topology, this parameter is required. The mimimum accepted value is 1.

If you specify MultiCluster in spec.topology, this parameter is ignored.

MongoDB Ops Manager资源还可以使用以下设置:

spec.backup.fileSystemStores

类型:字符串

标识文件系统快照存储的名称。要学习更多信息,请参阅使用 Kubernetes 操作符 配置 文件系统 备份 存储。

spec.backup.logging.LogBackAccessRef

类型:字符串

对 ConfigMap 的引用,其中包含用于配置MongoDB Ops Manager备份日志的自定义 logback-access.xml文件。

ConfigMap 中的键必须与 logback-access.xml 的名称完全匹配,以确保它替换MongoDB Ops Manager Pod 中的默认文件。

要学习;了解更多信息,请参阅使用 CRD 配置MongoDB Ops Manager日志。

spec.backup.logging.LogBackRef

类型:字符串

对包含自定义logback.xml文件的 ConfigMap 的引用。 此文件配置MongoDB Ops Manager备份的一般日志记录行为,包括日志轮换策略、日志级别和其他日志记录参数。

ConfigMap 中的键必须与 logback-access.xml 的名称完全匹配,以确保它替换MongoDB Ops Manager Pod 中的默认文件。 要学习;了解更多信息,请参阅使用 CRD 配置MongoDB Ops Manager日志。

spec.logging.LogBackAccessRef

类型:字符串

对 ConfigMap 的引用,其中包含用于配置MongoDB Ops Manager日志的自定义 logback-access.xml文件。

ConfigMap 中的键必须完全是 logback-access.xml,以确保它替换MongoDB Ops Manager Pod 中的默认文件。

要学习;了解更多信息,请参阅使用 CRD 配置MongoDB Ops Manager日志。

spec.logging.LogBackRef

类型:字符串

对包含自定义logback.xml文件的 ConfigMap 的引用。 此文件配置MongoDB Ops Manager的一般日志记录行为,包括日志轮换策略、日志级别和其他日志记录参数。

ConfigMap 中的键必须完全是 logback.xml,以确保它替换MongoDB Ops Manager Pod 中的默认文件。

要学习;了解更多信息,请参阅使用 CRD 配置MongoDB Ops Manager日志。

注意

If the size of files the Ops Manager dashboard generates is larger than the storage space available in the emptyDir volume, consider overriding the emptyDir volume with a Persistent Volume to prevent pod crashes. To learn more, see spec.statefulSet.spec.template.spec.volumes.

spec.opsManagerURL

类型:字符串

可选。 Operator 中URL MongoDB Ops Manager资源的 ,例如:Kuberneteshttps://link.to.configured.lb.example.com 。

  • 如果省略此参数,则在连接到MongoDB Ops Manager实例时, Kubernetes Operator 使用以下URL作为MongoDB Ops Manager实例的默认 URL:<om-name>-svc.{namespace}.svc.cluster.local。 这是 无头服务的 FQDNMongoDB Ops Manager 。

  • 如果指定此参数,则可将此 URL 更改为其他 URL。

注意

Don't confuse the spec.opsManagerURL with the URL that you specify in a ConfigMap for a particular deployment to configure MongoDB deployments and Monitoring Agents for the Application Database. The Kubernetes Operator requires to have the spec.opsManagerURL to directly connect to Ops Manager instances and to configure Ops Manager and Application Database deployments. The Kubernetes Operator doesn't use the spec.opsManagerURL to manage particular MongoDB databases.

Change the spec.opsManagerURL parameter to a custom URL in the following cases:

  • 当您跨多个MongoDB Ops Manager Kubernetes集群部署URL ,并且无法从MongoDB Ops Manager 托管 Pod 访问默认 时。例如,当您在部署MongoDB Ops Manager KubernetesKubernetesOperator 之外的其他 集群上部署 时,可能无法访问MongoDB Ops Manager 服务的 FQDN 。在这种情况下,您可以指定自定义 URL。

  • 在外部域上配置对MongoDB Ops Manager实例的外部访问时,您可以指定自定义URL 。 这还要求 Kubernetes Operator 和应用程序数据库的监控代理使用此自定义 URL,而不是默认 URL。

spec.clusterDomain

类型:字符串

Kubernetes assigns each Pod a FQDN. The Kubernetes Operator calculates the FQDN for each Pod using a provided clusterDomain. Kubernetes doesn't provide an API to query these hostnames.

spec.clusterName

重要

spec.clusterName 已弃用

改用 spec.clusterDomain。

类型:字符串

Kubernetes assigns each Pod a FQDN. The Kubernetes Operator calculates the FQDN for each Pod using a provided clusterName. Kubernetes doesn't provide an API to query these hostnames.

spec.configuration

类型:集合

Ops Manager configuration properties. See Ops Manager Configuration Settings for property names and descriptions. Each property takes a value of type string.

重要

如果 Ops Manager 要管理部署在其所部署到的 Kubernetes 集群外部的 MongoDB 资源,您必须将mms.centralUrl设置添加到spec.configuration 。

将该值设置为 Ops Manager 在 Kubernetes 集群外部公开的 URL。

要学习;了解更多信息,请参阅管理外部MongoDB部署。

spec.configuration.mms.featureFlag.automation.verifyDownloads

类型:字符串

当设置为enabled时,MongoDB Agent需要所有由Ops Manager实例托管的MongoDB部署的签名文件。

当您在启用此选项的情况下升级 MongoDB Agent时,当前版本的 MongoDB Agent需要新的 MongoDB Agent二进制文件的签名文件。

要了解更多信息,请参阅验证 MongoDB 签名。

spec.configuration.mms.featureFlag.backup.queryable

类型:布尔值

设置为false以禁用可查询备份。

spec.configuration.mms.featureFlag.backup.wt.queryable

类型:布尔值

设置为false可在使用 WiredTiger 时禁用可查询备份。

spec.configuration.mms.mongoDbUsage.defaultUsageType

类型:字符串

The Kubernetes service's default server type.

接受的值为: PRODUCTION_SERVER 、 TEST_SERVER 、 DEV_SERVER和RAM_POOL 。

spec.jvmParameters

类型:字符串数组

可选。 传递给container中的Ops Manager应用程序的Java虚拟机(JVM)参数。任何给定的参数都会替换 Ops Manager 应用程序的默认Java虚拟机(JVM)参数。

此 Kubernetes Operator 参数默认为空列表。

spec:
jvmParameters: ["-XX:+HeapDumpOnOutOfMemoryError","-XX:HeapDumpPath=/tmp"]

重要

更改 Java虚拟机(JVM) 内存堆值,需您自担风险

Kubernetes 操作符会根据容器的内存,计算 MongoDB Ops Manager 应用程序的 Java虚拟机(JVM)内存堆值。更改 -Xms 和 -Xmx 值可能会导致 Ops Manager 出现问题。

spec.security.certsSecretPrefix

类型:字符串

密钥 前缀的文本Kubernetes 您创建的包含 的MongoDB Ops Manager TLS 密钥和证书的密钥。

您必须将密钥命名为<prefix>-<metadata.name>-cert 。

要了解如何将 Ops Manager 实例配置为通过HTTPS运行,请参阅部署 Ops Manager 资源。

spec.security.tls.ca

ConfigMap 的名称Kubernetes ,其中包含 的自定义 CA MongoDB Ops Manager文件。

重要

spec.security.tls.ca is required if you use a custom CA to sign your Ops Manager TLS certificates.

Kubernetes 操作符要求您在 ConfigMap 中为 Ops Manager 资源mms-ca.crt的证书命名。

此CA签署的证书:

  • 客户端用于连接到 Ops Manager 应用程序,以及

  • 应用程序数据库Pod中用于与MongoDB Ops Manager通信的代理。

警告

您必须拼接您的自定义 CA 文件和来自 downloads.mongodb.com 的整个 TLS 证书链,以防止 MongoDB Ops Manager 在应用程序数据库重启时变得无法运行。

spec.security.tls.enabled

重要

spec.security.tls.enabled 已弃用,并将在未来版本中删除。要启用 TLS ,请为 spec.security.certsSecretPrefix 设置提供一个值。

使用TLS证书对客户端和 Ops Manager 之间的通信进行加密。

spec.statefulSet.spec

类型:集合

MongoDB Controllers for Kubernetes Operator 为MongoDB Ops Manager创建的 StatefulSet 规范。

要查看可以向 spec.statefulSet.spec 添加哪些字段,请参阅Kubernetes文档中的 StatefulSetSpec v1 apps。

spec.statefulSet.spec.template

类型:集合

MongoDB Controllers for Kubernetes Operator 为MongoDB Ops Manager创建的 StatefulSet 中Kubernetes Pod 的模板。

注意

The Kubernetes Operator doesn't validate the fields you provide in spec.statefulSet.spec.template.

spec.statefulSet.spec.template.metadata

类型:集合

MongoDB Controllers for Kubernetes Operator 为MongoDB Ops Manager创建的 StatefulSet 中Kubernetes Pod 的元数据。

要查看可以添加到 spec.statefulSet.spec.template.metadata 的字段,请参阅Kubernetes文档。

spec.statefulSet.spec.template.spec

类型:集合

Kubernetes Operator 的MongoDB控制器为MongoDB Ops Manager创建的StatefulSet中Kubernetes Pod 的规范。

要查看可添加到 spec.statefulSet.spec.template.spec 的字段的完整列表,请参阅Kubernetes文档。

以下示例spec.statefulSet.spec.template.spec 定义了MongoDB Controllers for Kubernetes Operator 部署的一个MongoDB Ops Manager容器的最小和最大 CPU 和内存容量:

提示

For more information on the hardware, software, and networking requirements for the hosts that run the Ops Manager components, see Ops Manager System Requirements in the Ops Manager Documentation.

statefulSet:
spec:
template:
spec:
containers:
- name: mongodb-ops-manager
resources:
requests:
cpu: "4"
memory: "16Gi"
limits:
cpu: "8"
memory: "32Gi"
spec.statefulSet.spec.template.spec.containers

类型:集合

MongoDB Controllers for Kubernetes Operator 为 MongoDB Ops Manager 创建的 StatefulSet 中 Kubernetes Pod 的容器列表。

要修改 Ops Manager container的规范,您必须使用name字段提供container的确切名称,如以下示例所示:

backup:
statefulSet:
spec:
template:
spec:
containers:
- name: mongodb-ops-manager

注意

当您将container添加到spec.statefulSet.spec.template.spec.containers时,Kubernetes 操作符会将它们添加到 Kubernetes pod 中。这些容器附加到 Pod 中的 Ops Manager 容器。

spec.statefulSet.spec.template.spec.containers.resources.requests.cpu

类型:字符串

Kubernetes节点上托管MongoDB Ops Manager必须提供的最小 CPU容量。

The requested value must be less than or equal to spec.statefulSet.spec.template.spec.containers.resources.limits.cpu.

spec.statefulSet.spec.template.spec.containers.resources.limits.cpu

类型:字符串

为托管Ops Manager而创建的节点的最大 CPU容量。如果省略,则该值设立为 spec.statefulSet.spec.template.spec.containers.resources.requests.cpu。

spec.statefulSet.spec.template.spec.containers.resources.requests.memory

类型:字符串

节点 上必须可用的最小内存容量KubernetesMongoDB Ops Manager Kubernetes在 上托管 。该值以整数表示,后跟采用JEDEC表示法的内存单位。

例子

如果 Kubernetes 上的 Ops Manager 需要 6 GB 内存,请将此值设置为6Gi 。

注意

MongoDB 建议将此值至少设置为5Gi 。

The requested value must be less than or equal to spec.statefulSet.spec.template.spec.containers.resources.limits.memory.

spec.statefulSet.spec.template.spec.containers.resources.limits.memory

类型:字符串

为托管Ops Manager而创建的节点的最大内存容量。如果省略,则该值设立为 spec.statefulSet.spec.template.spec.containers.resources.requests.memory。

Kubernetes Operator 根据容器内存计算并设置 Java 堆大小的参数。

警告

将此值限制为小于 32 GB

将此值设置为大于 32 GB ( 32Gi ) 的值可能会导致备份服务出现问题。 过多的堆可能会在 Ops Manager 中导致不可预知的结果。

spec.statefulSet.spec.template.spec.volumes

类型:集合

容器可以在StatefulSet MongoDB Controllers for Kubernetes 操作符 为Ops Manager创建的中挂载的卷的列表。

如果您使用Ops Manager仪表盘请求部署的日志,并且临时文件的大小非常大,请考虑为Ops Manager StatefulSet 中的 data Kubernetes 卷使用持久卷。

默认下,data Kubernetes 卷使用 emptyDir 类型。要覆盖它并使用持久卷,请将以下配置添加到您的 MongoDBOpsManager资源中:

statefulSet:
spec:
template:
spec:
volumes:
- name: data
persistentVolumeClaim:
claimName: <my-pvc>

将 <my-pvc> 替换为您的 Kubernetes PersistentVolumeClaim。 名称。

This section describes optional settings related to external connectivity in Ops Manager. For optional external connectivity settings specific to your multi-cluster Ops Manager deployment, see Multi-Cluster Settings.

spec.externalConnectivity

类型:集合

启用与MongoDB Ops Manager 的外部连接的配置对象。 如果提供, Kubernetes Operator 将创建一个Kubernetes 服务,允许来自Kubernetes集群外部的流量到达MongoDB Ops Manager应用程序。

如果未提供,Kubernetes Operator 不会创建 Kubernetes 服务。 您必须手动创建一个解决方案,或使用第三方解决方案,使您能够将外部流量路由到 Kubernetes 集群中的 Ops Manager 应用程序。

spec.externalConnectivity.type

类型:字符串

在Kubernetes之外公开MongoDB Ops Manager 的Kubernetes服务 ServiceType。

Required if spec.externalConnectivity.type is present.

接受的值为: LoadBalancer和NodePort 。 如果您的云提供商支持,则建议使用LoadBalancer 。 使用NodePort进行本地部署。

spec.externalConnectivity.port

类型:整型

指示 Kubernetes 服务公开 Ops Manager 应用程序的端口应用于外部流量的值。

  • If spec.externalConnectivity.type is NodePort:

    • Kubernetes 服务通过此端口向外部流量公开 Ops Manager 应用程序。

    • If you don't provide a spec.externalConnectivity.port value, the Kubernetes service routes traffic to the Ops Manager Application from an available port selected randomly from the following default range: 30000-32767.

      注意

      您必须将网络的防火墙配置为允许通过此端口的流量。

  • If spec.externalConnectivity.type is LoadBalancer:

    • 云提供商创建的负载均衡器资源通过此端口公开 Ops Manager 应用程序。

    • If you don't provide a spec.externalConnectivity.port value, the Kubernetes service exposes the Ops Manager Application to external traffic through the default HTTP (8080) or HTTPS (8443) port.

spec.externalConnectivity.loadBalancerIP

类型:字符串

Kubernetes Operator 创建LoadBalancer Kubernetes 服务时使用的 IP 地址。

仅当您的云提供商支持且 spec.externalConnectivity.type 为 LoadBalancer 时,才能使用此设置。要学习;了解有关类型 LoadBalancer 的更多信息,请参阅Kubernetes文档。

spec.externalConnectivity.externalTrafficPolicy

类型:字符串

将外部流量路由到 Ops Manager Kubernetes 服务的策略。该服务根据此设置的值将外部流量路由到节点本地或集群范围的端点。

接受的值为:Cluster 和 Local。要学习;了解哪些值可以满足您的要求,请参阅Kubernetes文档中的Kubernetes中的源 IP。

注意

如果您选择Cluster ,则客户端的Source-IP在 Kubernetes 网络边界发生的网络跳跃期间会丢失。

spec.externalConnectivity.annotations

类型:集合

键值对,允许您提供特定于云提供商的配置设置。

要学习;了解有关Amazon Web Services上的注释和 TLS支持的更多信息,请参阅Kubernetes文档。

本节介绍与MongoDB Ops Manager中的备份相关的可选设置。 有关特定于多集群MongoDB Ops Manager部署的可选备份设置,请参阅多集群设置。

spec.backup.assignmentLabels

类型:字符串数组

备份守护程序服务进程的分配标签列表。 使用分配标签来标识与特定项目相关联的特定备份守护进程。 如果使用Kubernetes Operator 设置分配标签,则在Kubernetes配置文件中为分配标签设置的值将覆盖MongoDB Ops Manager用户界面中定义的值。 未使用Kubernetes Operator 设置的分配标签将继续使用MongoDB Ops Manager用户界面中设置的值。

spec.backup.enabled

类型:布尔值

为 Ops Manager 资源启用备份的标志。设置为false时,将禁用备份。

默认值为true 。

spec.backup.encryption

类型:对象

包含备份加密配置设置的对象。

spec.backup.encryption.kmip

类型:对象

Object that contains the KMIP backup encryption configuration settings. To learn more, see Configure KMIP Backup Encryption for Ops Manager.

注意

If you set this parameter, the API key linked with the value of spec.credentials must have the Global Owner role.

spec.backup.encryption.kmip.server

类型:对象

包含KMIP备份加密服务器配置设置的对象。

spec.backup.encryption.kmip.server.ca

类型:字符串

人类可读标签,用于标识包含用于 KMIP 身份验证的 CA 证书 () 的条目的 ConfigMap。ca.pem

spec.backup.encryption.kmip.server.url

类型:字符串

KMIP 服务器的 URLhostname.port 192.168.1.3:5696my-kmip-server.mycorp.com:5696,该 URL 采用 格式 (示例如 或)。

spec.backup.headDB

类型:集合

头部数据库的配置设置。Kubernetes Operator 创建具有指定配置的持久卷声明。

标量
数据类型
说明

labelSelector

字符串

storage

字符串

应安装的持久卷的最小大小。此值以整数表示,后跟采用 JEDEC 表示法的存储单位。

默认值为30Gi 。

要学习;了解更多信息,请参阅备份守护程序硬件要求。

示例,如果头部数据库需要60 GB 的存储空间,设立将该值设置为60Gi 。

storageClass

字符串

持久卷声明中指定的存储类型。您可以先将此存储类型创建为StorageClass对象,然后再用于此对象规范。

确保将StorageClass reclaimPolicy设立为Retain。这可确保在删除持久卷声明时保留数据。

spec.backup.jvmParameters

类型:字符串数组

可选。 传递给容器中 Ops Manager 备份服务的JVM参数。

此 Kubernetes Operator 参数默认为空列表。

spec:
backup:
jvmParameters: ["-XX:+UseStringCache"]

警告

更改 Java虚拟机(JVM) 内存堆值,需您自担风险

Kubernetes 操作符根据容器的内存计算备份服务的 Java虚拟机(JVM) 内存堆值。更改 -Xms 和 -Xmx 值可能会导致 Ops Manager 出现问题。

spec.backup.members

类型:整型

Optional. Number of backup daemon services to deploy in Kubernetes. If not specified, defaults to 1. To ensure high availability for your backup service, deploy multiple backup daemons in Ops Manager.

spec.backup.opLogStores

类型:集合

Required if you enable backup. Array of oplog stores used for backup. Each item in the array references a MongoDB database resource deployed in the Kubernetes cluster by the Kubernetes Operator.

spec.backup.opLogStores.assignmentLabels

类型:字符串数组

A list of assignment labels for the oplog store. Use assignment labels to identify that specific oplog stores are associated with particular projects. If you set assignment labels using the Kubernetes Operator, the values that you set in the Kubernetes configuration file for assignment labels override the values defined in the Ops Manager UI. Assignment labels that you don't set using the Kubernetes Operator continue to use the values set in the Ops Manager UI.

spec.backup.opLogStores.name

类型:字符串

如果启用备份,则为必填项。 oplog 存储的名称。

重要

一旦指定,请勿编辑 oplog 存储的名称。

spec.backup.opLogStores.mongodbResourceRef.name

类型:字符串

如果启用备份,则为必填项。 您创建的用于存储oplog切片的MongoDB资源或MongoDBMultiCluster资源的名称。 您必须将此资源部署在与MongoDB Ops Manager资源相同的命名空间中。

Oplog 数据库仅支持SCRAM身份验证机制。 您无法启用其他身份验证机制。

如果在 oplog 数据库上启用SCRAM身份验证,则必须:

  • 创建 MongoDB 资源以将 Ops Manager 连接到 oplog 数据库。

  • Specify the name of the user in the Ops Manager resource definition.

如果不存在具有此名称的 MongoDB database 资源,则backup资源将进入Pending状态。Kubernetes 操作符每 10 秒重试一次,直到创建具有此名称的 MongoDB database 资源。

注意

当您对此设置中引用的数据库资源进行安全更改时,Kubernetes 操作符开始自动协调 Ops Manager 资源。Kubernetes 操作符根据您的更改更新 Ops Manager 配置中的mongoUri和ssl标志。

spec.backup.opLogStores.mongodbUserRef.name

类型:字符串

SCRAM如果在 上启用了Oplog Store Database 身份验证,则为必填项。MongoDB用于连接 的Oplog Store Database 用户资源的名称。将此用户资源部署在与MongoDB Ops Manager资源相同的命名空间中,并具有以下所有角色:

spec.backup.blockStores

类型:集合

Required if you enable Backup using a blockstore. Array of blockstores used for Backup. Each item in the array references a MongoDB database resource deployed in the Kubernetes cluster by the Kubernetes Operator.

spec.backup.blockStores.assignmentLabels

类型:字符串数组

块存储的分配标签列表。 使用分配标签来标识特定的块存储与特定项目相关联。 如果使用Kubernetes Operator 设置分配标签,则在Kubernetes配置文件中为分配标签设置的值将覆盖MongoDB Ops Manager用户界面中定义的值。 未使用Kubernetes Operator 设置的分配标签将继续使用MongoDB Ops Manager用户界面中设置的值。

spec.backup.blockStores.name

类型:字符串

如果使用块存储启用备份,则为必填项。 块存储的名称。

重要

指定后,请勿编辑块存储的名称。

spec.backup.blockStores.mongodbResourceRef.name

类型:字符串

如果使用块存储启用备份,则为必填项。 您为块存储创建的MongoDB database资源的名称。 您必须将此数据库资源部署在与MongoDB Ops Manager资源相同的命名空间中。

块存储数据库仅支持SCRAM身份验证机制。 您无法启用其他身份验证机制。

如果在块存储数据库上启用SCRAM身份验证,则必须:

  • 创建 MongoDB 用户资源以将 Ops Manager 连接到块存储数据库。

  • Specify the name of the user in the Ops Manager resource definition.

如果不存在具有此名称的 MongoDB database 资源,则backup资源将进入Pending状态。Kubernetes 操作符每 10 秒重试一次,直到创建具有此名称的 MongoDB database 资源。

注意

当您对此设置中引用的数据库资源进行安全更改时,Kubernetes 操作符开始自动协调 Ops Manager 资源。Kubernetes 操作符根据您的更改更新 Ops Manager 配置中的mongoUri和ssl标志。

spec.backup.blockStores.mongodbUserRef.name

类型:字符串

如果在块存储数据库上启用了 SCRAM 身份验证,则为必填项。 用于连接块存储数据库的 MongoDB 用户资源的名称。 将此用户资源部署在与MongoDB Ops Manager资源相同的命名空间中,并具有以下所有角色:

spec.backup.queryableBackupSecretRef.name

类型:字符串

Name of the secret that contains the queryable.pem file from Ops Manager that you will use for accessing and querying backups based on your deployment's TLS requirements.The PEM file contains a public key certificate and its associated private key that are needed to access and run queries on backup snapshots in Ops Manager. To query backups, specify the value for this parameter. If not set, backups are not affected, but you can't query them.

spec.backup.statefulSet.spec

类型:集合

MongoDB Controllers for Kubernetes Operator 为 备份守护进程服务 创建的 StatefulSet 规范。

要查看可以向 spec.backup.statefulSet.spec 添加哪些字段,请参阅Kubernetes文档中的 StatefulSetSpec v1 apps。

spec.backup.statefulSet.spec.template

类型:集合

MongoDB Controllers for Kubernetes Operator 为备份守护进程服务创建的 StatefulSet 中Kubernetes Pod 的模板。

注意

The Kubernetes Operator doesn't validate the fields you provide in spec.backup.statefulSet.spec.template.

spec.backup.statefulSet.spec.template.metadata

类型:集合

Kubernetes Operator 的MongoDB控制器为备份守护进程服务创建的 StatefulSet 中Kubernetes Pod 的元数据。

要查看可以添加到 spec.backup.statefulSet.spec.template.metadata 的字段,请参阅Kubernetes文档。

spec.backup.statefulSet.spec.template.spec

类型:集合

Kubernetes Operator 的MongoDB控制器为备份守护进程服务创建的 StatefulSet 中Kubernetes Pod 的规范。

要查看可添加到 spec.backup.statefulSet.spec.template.spec 的字段的完整列表,请参阅Kubernetes文档。

以下示例spec.backup.statefulSet.spec.template.spec 定义了 MongoDB Controllers for Kubernetes Operator 部署的一个 备份守护进程服务 容器的最小和最大 CPU 和内存容量:

提示

For more information on the hardware, software, and networking requirements for the hosts that run the Ops Manager components, see Ops Manager System Requirements in the Ops Manager Documentation.

statefulSet:
spec:
template:
spec:
containers:
- name: mongodb-backup-daemon
resources:
requests:
cpu: "4"
memory: "8Gi"
limits:
cpu: "8"
memory: "16Gi"
spec.backup.statefulSet.spec.template.spec.containers

类型:集合

属于MongoDB Controllers for Kubernetes Operator 为备份守护进程服务创建的 StatefulSet 中Kubernetes Pod 的容器列表。

To modify the specifications of the backup daemon service container, you must provide the exact name of the container using the name field, as shown in the following example:

backup:
statefulSet:
spec:
template:
spec:
containers:
- name: mongodb-backup-daemon

注意

当您将容器添加到spec.backup.statefulSet.spec.template.spec.containers时,Kubernetes Operator 会将它们添加到 Kubernetes Pod 中。 这些容器附加到 Pod 中的备份守护程序服务容器。

spec.backup.statefulSet.spec.template.spec.containers.resources.requests.cpu

类型:字符串

Kubernetes节点上托管备份守护进程服务必须提供的最小 CPU容量。

The requested value must be less than or equal to spec.backup.statefulSet.spec.template.spec.containers.resources.limits.cpu.

spec.backup.statefulSet.spec.template.spec.containers.resources.limits.cpu

类型:字符串

为托管备份守护进程服务而创建的节点的最大 CPU容量。如果省略,则该值设立为 spec.backup.statefulSet.spec.template.spec.containers.resources.requests.cpu。

spec.backup.statefulSet.spec.template.spec.containers.resources.requests.memory

类型:字符串

Kubernetes 节点 上必须可用的最小内存容量 在Kubernetes上托管 备份守护进程服务 。该值以整数表示,后跟采用JEDEC表示法的内存单位。

注意

将此值至少设置为4.5Gi 。 小于4.5Gi的值可能会导致错误。

The requested value must be less than or equal to spec.backup.statefulSet.spec.template.spec.containers.resources.limits.memory.

spec.backup.statefulSet.spec.template.spec.containers.resources.limits.memory

类型:字符串

为托管备份守护进程服务而创建的节点的最大内存容量。如果省略,则该值设立为 spec.backup.statefulSet.spec.template.spec.containers.resources.requests.memory。

Kubernetes Operator 根据容器内存计算并设置 Java 堆大小的参数。

警告

将此值限制为小于 32 GB

将此值设置为大于 32 GB ( 32Gi ) 的值可能会导致备份服务出现问题。 过多的堆可能会在 Ops Manager 中导致不可预知的结果。

您可以将Ops Manager配置为使用 S3 存储 oplog 和备份快照,并使用自定义 CA 颁发的密钥通过 TLS 保护与 S3 的连接。

To configure custom CA keys, use the ConfigMap with which you configured TLS for your Application Database as described on the TLS-Encrypted Connection (HTTPS) tab of Deploy an Ops Manager Resource. Set spec.applicationDatabase.security.tls.ca to this ConfigMap.

您可以将 TLS 用于 S3 和您的应用程序数据库,或者只用于 S3。

  • 要对两者都使用 TLS,请从 ConfigMap 中引用的同一个 ca-pem 获取用于这两种目的的证书。

  • 仅对 TLS 使用 S3 时,请勿在 ConfigMap 中定义 spec.security.applicationDatabase.certsSecretPrefix 。

spec.backup.s3OpLogStores.assignmentLabels

类型:字符串数组

S3 oplog存储的分配标签列表。使用分配标签来标识特定的 S3 oplog存储与特定项目相关联。如果使用Kubernetes Operator设立分配标签,则在Kubernetes配置文件中为分配标签设立的值将覆盖Ops Manager用户界面中定义的值。未使用Kubernetes Operator设立的分配标签将继续使用Ops Manager 用户界面中设立的值。

spec.backup.s3OpLogStores.customCertificate

类型:布尔值

Deprecated. Use spec.backup.s3OpLogStores.customCertificateSecretRefs instead.

指示是否将 AppDB 证书appdb-ca () 用作您的 S3 oplog 存储的自定义 TLS 证书。默认值为 False。

spec.backup.s3OpLogStores.customCertificateSecretRefs

类型:对象数组

使用Kubernetes密钥的 S3 oplog存储的自定义证书列表。 base64 编码的 x.509 证书必须已存在于带有密钥的Kubernetes密钥中,并且必须可由Java CertifcateFactory 进行解析。您不能在一个密钥中指定链中的多个证书。如果您在一个密钥中指定链中的多个证书, Kubernetes Operator 仅使用链中的第一个证书。如果您还提供了 customCertificate 设置, Kubernetes Operator 将使用 spec.applicationDatabase.security.tls.ca 作为备份的自定义证书。

Each entry in the list specifies the name and the key. If you specify multiple secrets, Kubernetes Operator uses all the certificates in the specified secrets.

如果您不提供此设置,Ops Manager 将使用 Ops Manager 使用的JVM默认信任存储。

spec.backup.s3OpLogStores.customCertificateSecretRefs.name

类型:字符串

需要为 S3 oplog存储使用自定义证书。包含自定义证书的Kubernetes密钥。

spec.configuration.mms.mongoDbUsage.defaultUsageType

类型:字符串

The Kubernetes service's default server type.

spec.backup.s3OpLogStores.customCertificateSecretRefs.key

类型:字符串

Required to use custom certificates for your S3 oplog store. File that represents the key in the secret that contains the base64-encoded x.509 certificate. If you don't specify this setting, the Kubernetes Operator can't utilize the custom certificate for S3 oplog store backups.

spec.backup.s3OpLogStores.irsaEnabled

类型:布尔值

Flag that enables using AWS IAM roles for service accounts in AWS EKS to configure an S3 oplog store. The default is False. If you aren't using AWS EKS, this flag has no effect. When set to False, using AWS IAM roles for service accounts in EKS to configure an S3 oplog store is disabled. To learn more, see IAM roles for service accounts in EKS.

spec.backup.s3OpLogStores.name

类型:字符串

必须使用 S3 存储来存储 oplog。S3 oplog 存储的名称。

spec.backup.s3OpLogStores.mongodbResourceRef.name

类型:字符串

您创建的 MongoDB 数据库资源的名称,该资源用于存储用于 S3 oplog 存储的元数据。您必须在与MongoDB Ops Manager资源相同的命名空间中部署此数据库资源。

注意

省略此设置,以使用应用程序数据库存储 S3 oplog 存储的元数据。

If you omit this setting, you must also omit the spec.backup.s3OpLogStores.mongodbUserRef.name setting. The Kubernetes Operator handles SCRAM user authentication internally.

如果您对此数据库启用SCRAM身份验证,则必须:

  • 创建 MongoDB 用户资源以将 Ops Manager 连接到数据库。

  • Specify the name of the user in the Ops Manager resource definition.

spec.backup.s3OpLogStores.mongodbUserRef.name

类型:字符串

如果您创建了 MongoDB 数据库资源以存储 S3 oplog 元数据,并且在此数据库上启用了 SCRAM,则必须进行此操作。MongoDB 用户资源的名称,用于连接到 S3 oplog 存储的元数据数据库。将此用户资源部署在与 MongoDB Ops Manager 资源相同的命名空间中,并具有以下所有角色:

重要

指定后,请勿编辑 S3 元数据 oplog 存储用户名的名称。

spec.backup.s3OpLogStores.s3SecretRef.name

类型:字符串

如果 spec.backup.s3OpLogStores.irsaEnabled 未设立为 true,则需要使用 S3存储来存储oplog 。

包含 accessKey 和 secretKey 字段的密钥名称。备份守护进程服务使用这些字段的值作为凭证来访问权限AWS S3 或 S3 兼容存储桶。要配置 S3 oplog存储,您必须在密钥中指定两个密钥。

如果将 spec.backup.s3OpLogStores.irsaEnabled设立为 true,则无需设立s3SecretRef,因为Amazon Web Services S3凭证将作为 Pod 环境变量安装。

spec.backup.s3OpLogStores.pathStyleAccessEnabled

类型:布尔值

指示存储桶端点 URL 的样式。

值
说明
例子

true

路径样式 URL

s3.amazonaws.com/<bucket>

false

虚拟主机样式 URL

<bucket>.s3.amazonaws.com

要学习;了解有关Amazon Web Services上的注释和 TLS支持的更多信息,请参阅Kubernetes文档。

默认值为true 。

spec.backup.s3OpLogStores.s3BucketEndpoint

类型:字符串

必须使用 S3 存储来存储 oplog。URL 地址,用于托管 oplog 存储的 Amazon Web Services S3 存储桶或 S3兼容存储桶。

注意

If your endpoint doesn't include a region in its URL, specify the s3RegionOverride field.

spec.backup.s3OpLogStores.s3BucketName

类型:字符串

必须使用 S3 存储来存储 oplog。托管 oplog 存储的 AWS S3 存储桶或 S3 兼容存储桶的名称。

spec.backup.s3OpLogStores.s3RegionOverride

类型:字符串

S3 兼容存储桶所在的区域。仅当 S3 oplog存储的 s3BucketEndpoint 不支持地区作用域时才使用此字段。地区范围是指您的端点在其URL中不包含地区。

请勿将此字段与 AWS S3 存储桶一起使用。有关更多信息,请参阅 S3 块存储配置。

spec.backup.s3Stores.assignmentLabels

类型:字符串数组

存储数据库备份快照的 S3 或 S3 兼容存储桶的分配标签列表。使用分配标签来标识特定的 S3 存储与特定项目相关联。如果使用Kubernetes Operator设立分配标签,则在Kubernetes配置文件中为分配标签设立的值将覆盖Ops Manager用户界面中定义的值。未使用Kubernetes Operator设立的分配标签将继续使用Ops Manager 用户界面中设立的值。

spec.backup.s3Stores.customCertificate

类型:布尔值

Deprecated. Use spec.backup.s3Stores.customCertificateSecretRefs instead.

指示是否使用应用程序数据库的证书appdb-ca () 作为您的 S3 备份的自定义 TLS 证书的标志。默认值为 False。

spec.backup.s3Stores.customCertificateSecretRefs

类型:对象数组

使用Kubernetes密钥的 S3快照存储的自定义证书列表。 base64 编码的 x.509 证书必须已存在于带有密钥的Kubernetes密钥中,并且必须可由Java CertifcateFactory 进行解析。您不能在一个密钥中指定链中的多个证书。如果您在一个密钥中指定链中的多个证书, Kubernetes Operator 仅使用链中的第一个证书。如果您还提供了 spec.backup.s3Stores.customCertificate 设置, Kubernetes Operator 将使用 spec.applicationDatabase.security.tls.ca 作为备份的自定义证书。

Each entry in the list specifies the name and the key. If you specify multiple secrets, Kubernetes Operator uses all the specified secrets.

如果您不提供此设置,Kubernetes 操作符将使用 Ops Manager 使用的Java虚拟机(JVM)默认信任存储进行备份。

spec.backup.s3Stores.customCertificateSecretRefs.name

类型:字符串

需要为 S3 oplog存储使用自定义证书。包含自定义证书的Kubernetes密钥。

spec.backup.s3Stores.customCertificateSecretRefs.key

类型:字符串

Required to use custom certificates for your S3 oplog store. File that represents the key in the secret that contains the base64-encoded x.509 certificate. If you don't specify this setting, Kubernetes Operator can't utilize the custom certificate for S3 snapshot store and defaults to the default trust store used by Ops Manager.

spec.backup.s3Stores.irsaEnabled

类型:布尔值

Flag that enables using AWS IAM roles for service accounts in AWS EKS to configure an S3 snapshot store. The default is False. If you aren't using AWS EKS, this flag has no effect. When set to False, using AWS IAM roles for service accounts in EKS to configure an S3 snapshot store is disabled. To learn more, see IAM roles for service accounts in EKS.

spec.backup.s3Stores.name

类型:字符串

必须使用 S3 存储来存储 oplog。S3 快照存储的名称。

重要

指定后,请勿编辑 S3 快照存储的名称。如果备份使用旧名称,则此更改很可能失败。成功变更的后果是无法预测的。

spec.backup.s3Stores.mongodbResourceRef.name

类型:字符串

MongoDB 资源或 MongoDBMultiCluster 资源的名称,您创建用于存储 S3 快照存储的元数据。您必须在与MongoDB Ops Manager资源相同的命名空间中部署此数据库资源。

注意

省略此设置,以使用应用程序数据库存储 S3 快照存储的元数据。

If you omit this setting, you must also omit the spec.backup.s3Stores.mongodbUserRef.name setting. The Kubernetes Operator handles SCRAM user authentication internally.

如果您对此数据库启用SCRAM身份验证,则必须:

  • 创建 MongoDB 用户资源以将 Ops Manager 连接到数据库。

  • Specify the name of the user in the Ops Manager resource definition.

重要

指定后,请勿编辑 S3 快照存储的名称。如果备份使用旧名称,则此更改很可能失败。成功变更的后果是无法预测的。

如果不存在具有此名称的 MongoDB database 资源,则backup资源将进入Pending状态。Kubernetes 操作符每 10 秒重试一次,直到创建具有此名称的 MongoDB database 资源。

注意

当您对此设置中引用的数据库资源进行安全更改时,Kubernetes 操作符开始自动协调 Ops Manager 资源。Kubernetes 操作符根据您的更改更新 Ops Manager 配置中的mongoUri和ssl标志。

spec.backup.s3Stores.mongodbUserRef.name

类型:字符串

如果创建了 MongoDB 数据库资源用于存储 |s3| 快照元数据,并在此数据库上启用了 SCRAM,则需要此项。MongoDB 用户资源的名称,用于连接到 S3 快照存储的元数据数据库。将此用户资源部署在与 MongoDB Ops Manager 资源相同的命名空间中,并具有以下所有角色:

重要

指定后,请勿编辑 S3 元数据快照存储用户名。

spec.backup.s3Stores.s3SecretRef.name

类型:字符串

如果使用 S3存储启用备份并且未将 spec.backup.s3Stores.irsaEnabled设立为 true,则为必填项。

包含 accessKey 和 secretKey 字段的密钥名称。备份守护进程服务使用这些字段的值作为凭证来访问权限AWS S3 或 S3 兼容存储桶。如果密钥缺少任一密钥,则无法配置 S3快照存储。

如果将 spec.backup.s3Stores.irsaEnabled设立为 true,则无需设立s3SecretRef,因为Amazon Web Services S3凭证将作为 Pod 环境变量安装。

spec.backup.s3Stores.objectLockEnabled

类型:布尔值

指定支持此快照存储的兼容 Amazon Web Services S3 或 S3 的存储桶是否已启用对象锁。将此字段设置为 true 以启用该存储的不可变备份。

This field is supported only with Ops Manager version 8.0.19 or later. For information about configuring immutable backups in Ops Manager, see Set Immutable Backup.

默认值为false 。

spec.backup.s3Stores.pathStyleAccessEnabled

类型:布尔值

指示存储桶端点 URL 的样式。

值
说明
例子

true

路径样式 URL

s3.amazonaws.com/<bucket>

false

虚拟主机样式 URL

<bucket>.s3.amazonaws.com

默认值为true 。

spec.backup.s3Stores.s3BucketEndpoint

类型:字符串

如果您使用 S3 存储启用备份,则必须进行此操作。用于托管快照存储的 AWS S3 存储桶或 S3兼容存储桶的 URL。

注意

If your endpoint doesn't include a region in its URL, specify the s3RegionOverride field.

spec.backup.s3Stores.s3BucketName

类型:字符串

如果您使用 S3 存储启用备份,则必须进行此操作。托管快照存储的 Amazon Web Services S3 存储桶或 S3兼容存储桶的名称。

spec.backup.s3Stores.s3RegionOverride

类型:字符串

S3 兼容存储桶所在的区域。仅当 S3 存储的 s3BucketEndpoint 不支持地区范围时才使用此字段。地区范围是指您的端点在其URL中不包含地区。

请勿将此字段与 AWS S3 存储桶一起使用。有关更多信息,请参阅 S3 块存储配置。

This section describes settings that you must use in addition to the required Ops Manager settings in order to configure your Ops Manager Application Database.

spec.applicationDatabase.version

类型:字符串

必需。 Ops Manager 应用程序数据库上安装的MongoDB版本。您必须根据容器注册表中的标签指定兼容的企业MongoDB版本。示例,8.0.0-ubi8。从Kubernetes Operator 版本 1.20 开始,标签不再以 -ent 结尾。

重要

请务必选择兼容的 MongoDB Server 版本。

兼容版本因 MongoDB 数据库资源使用的基础图片而异。

注意

If you update this value to a later version of MongoDB for the Application Database, the feature compatibility version remains at the MongoDB version you're upgrading from to give you the option to downgrade if necessary. If you want the feature compatibility version to match the new MongoDB version, you must manually set the featureCompatibilityVersion parameter under spec.applicationDatabase.

This section describes optional settings related to your Ops Manager Application Database. For optional application database settings specific to your multi-cluster Ops Manager deployment, see Multi-Cluster Settings.

spec.applicationDatabase

类型:集合

Ops Manager Application Database resource definition.

副本集资源规范中的以下设置是可选的。

spec.applicationDatabase.agent.logLevel

类型:字符串

默认值:INFO

配置 Pod 内自动化代理日志记录的级别。接受的值包括:

  • DEBUG

  • INFO

  • WARN

  • ERROR

  • FATAL

spec.applicationDatabase.agent.<component>.logRotate

类型:对象

将组件替换为以下值之一:

  • mongod

  • monitoringAgent

MongoDB configuration object for rotating the MongoDB logs of a process. To use the agent.<component>.logRotate settings, you must set systemLog.destination to file because you can't use the agent.<component>.logRotate settings if you're writing logs to the host's syslog system.

注意

If the size of files the Ops Manager dashboard generates is larger than the storage space available in the emptyDir volume, consider overriding the emptyDir volume with a Persistent Volume to prevent pod crashes. To learn more, see spec.statefulSet.spec.template.spec.volumes.

spec.applicationDatabase.agent.mongod.logRotate.numTotal

类型:整型

默认值:0

Total number of log files that Ops Manager retains. If you don't change the default, Ops Manager bases rotation on your other agent.<compenet>.logRotate settings.

spec.applicationDatabase.agent.mongod.logRotate.numUncompressed

类型:整型

默认值:5

保持未压缩状态的日志文件总数的最大数量,包括当前日志文件。

spec.applicationDatabase.agent.mongod.logRotate.percentOfDiskspace

类型:数字

默认值:0.02

Maximum percentage of total disk space that Ops Manager can use to store the log files expressed as decimal. If this limit is exceeded, Ops Manager deletes compressed log files until it meets this limit. Ops Manager deletes the oldest log files first.

spec.applicationDatabase.agent.<component>.logRotate.sizeThresholdMB

类型:数字

将组件替换为以下值之一:

  • mongod

  • monitoringAgent

Required if rotating logs. Maximum size in MB for an individual log file before Ops Manager rotates it. Ops Manager rotates the log file immediately if it meets the value given in either this sizeThresholdMB or the logRotate.timeThresholdHrs limit.

spec.applicationDatabase.agent.<component>.logRotate.timeThresholdHrs

类型:整型

将组件替换为以下值之一:

  • mongod

  • monitoringAgent

Required if rotating logs. Maximum duration in hours for an individual log file before the next rotation. The time is since the last rotation. Ops Manager rotates the log file immediately if it meets the value given in either timeThresholdHrs or the logRotate.sizeThresholdM limit.

spec.applicationDatabase.agent.mongod.auditlogRotate

类型:对象

用于轮换进程的MongoDBAtlas 审核日志的MongoDB配置对象。

spec.applicationDatabase.agent.mongod.auditlogRotate.numTotal

类型:整型

默认值:0

Total number of audit log files that Ops Manager retains. If you don't change the default value, Ops Manager bases rotation on your other agent.mongod.auditlogRotate settings.

spec.applicationDatabase.agent.mongod.auditlogRotate.numUncompressed

类型:整型

默认值:5

保持未压缩状态的Atlas 审核日志文件总数的最大数量,包括当前Atlas 审核日志文件。

spec.applicationDatabase.agent.mongod.auditlogRotate.percentOfDiskspace

类型:数字

默认值:0.02

Maximum percentage of total disk space that Ops Manager can use to store the audit log files expressed as decimal. If you exceed this limit, Ops Manager deletes compressed audit log files until it meets this limit. Ops Manager deletes the oldest audit log files first.

spec.applicationDatabase.agent.mongod.auditlogRotate.sizeThresholdMB

类型:数字

Required if rotating audit logs. Maximum size in MB for an individual audit log file before Ops Manager rotates it. Ops Manager rotates the audit log file immediately if it reaches the value in either sizeThresholdMB or the auditlogRotate.timeThresholdHrs limit.

spec.applicationDatabase.agent.mongod.auditlogRotate.timeThresholdHrs

类型:整型

Required if rotating audit logs. Maximum duration in hours for an individual audit log file before the next rotation. The time is since the last rotation. Ops Manager rotates the audit log file immediately if it reaches the value in either timeThresholdHrs or the auditlogRotate.sizeThresholdM limit.

spec.applicationDatabase.agent.startupOptions

类型:对象

用于启动选项的 MongoDB 配置对象。 有关可用字段,请参阅MongoDB Agent设置。

spec.applicationDatabase.agent.systemLog

类型:对象

用于配置systemLog选项的 MongoDB 配置对象。

spec.applicationDatabase.agent.systemLog.path

类型:字符串

默认: /var/log/mongodb-mms-automation/mongodb.log

The path of the log file to which mongod or mongos should send all diagnostic logging information, rather than the standard output or the host's syslog. MongoDB creates the log file at the specified path.

Linux 包初始化脚本不希望systemLog.path更改默认值。 如果使用 Linux 包并更改systemLog.path ,则必须使用自己的初始化脚本并禁用内置脚本。

spec.applicationDatabase.agent.systemLog.logAppend

类型:布尔值

默认: false

When true, mongos or mongod appends new entries to the end of the existing log file when the mongos or mongod instance restarts. Without this option, mongod will back up the existing log and create a new file.

spec.applicationDatabase.agent.systemLog.destination

类型:字符串

The destination to which MongoDB sends all log output. Specify either file or syslog. If you specify file, you must also specify systemLog.path.

If you don't specify systemLog.path, MongoDB sends all log output to standard output.

警告

系统日志守护进程在记录消息时生成时间戳,而不是在 MongoDB 发布消息时生成时间戳。这种行为可能会导致日志条目的时间戳具有误导性,尤其是当系统负载较重时。 我们建议对生产系统使用file选项,以确保时间戳的准确性。

spec.applicationDatabase.externalAccess

类型:集合

适用于外部连接的集群公开规范。要了解如何从 Kubernetes 集群外部连接到您的 MongoDB 资源,请参阅从 Kubernetes 外部连接到 MongoDB 数据库资源。

如果您添加 spec.externalAccess,则 Kubernetes Operator 为副本集中的每个 Pod 创建一个外部服务。外部服务为集群中的每个 MongoDB 数据库 Pod 提供外部入口点。每个外部服务具有选择器,它将外部服务与特定 Pod 相匹配。

如果添加此设置时不带任何值,Kubernetes Operator 会创建具有以下默认值的外部服务:

字段
值
说明

Name

<pod-name>-svc-external

外部服务的名称。您无法更改此值。

Type

LoadBalancer

创建外部 LoadBalancer 服务。

Port

<Port Number>

A port for mongod.

publishNotReadyAddress

true

指定即使 Pod 尚未准备就绪,也会创建 DNS 记录。对于任何数据库Pod,请勿设立为 false。

spec.externalAccess.externalService

类型:集合

覆盖spec.externalAccess中默认值的规范。

当您设立spec.externalAccess 设置时, Kubernetes Operator 会自动使用默认值创建外部负载负载均衡器服务。您可以根据需要覆盖某些值或添加新值。示例,如果您打算创建 NodePort 服务并且不需要负载负载均衡器,则必须在Kubernetes规范中配置覆盖:

externalAccess:
externalService:
annotations:
# cloud-specific annotations for the service
spec:
type: NodePort # default is LoadBalancer
# you can specify other spec overrides if necessary

有关 Kubernetes 规范的更多信息,请参阅 Kubernetes 文档中的 ServiceSpec。

spec.externalAccess.externalService.annotations

类型:集合

键值对,可让您将特定于云提供商的配置设置添加到部署中的所有集群。要学习;了解更多信息,请参阅Kubernetes云提供商的注释和文档。

您可以使用注解为Kubernetes Operator 部署使用的外部服务指定占位符值。Kubernetes Operator 会自动将这些值替换为正确的值,如下表所述。使用占位符,您可以在每个服务中为特定 Pod 提供特定注释。

值
说明

{resourceName}

{namespace}

{podIndex}

StatefulSet 分配且当前外部服务所针对的 Pod 的索引。

{podName}

等于{resourceName}-{podIndex} 。

{statefulSetName}

StatefulSet。等于 {resourceName}。

{externalServiceName}

根据指定的占位符值生成的外部服务名称。 等于{resourceName}-{podIndex}-svc-external 。

{mongodProcessDomain}

The domain name of the server that is hosting the mongod process. Equal to spec.externalAccess.externalDomain if specified. Otherwise, equal to the domain used for the mongod process FQDN.

例如,对于进程主机名mdb-rs-1.example.com , example.com是域名。

{mongodProcessFQDN}

The mongod process hostname set in the automation configuration.

进程主机名取决于您的部署配置。 如果已将部署配置为使用external domains ,则进程主机名将使用以下格式:

{resourceName}-{podIndex}.{mongodProcessDomain}

例如: mdb-rs-1.example.com

如果您的部署不使用外部域,则进程主机名将使用以下格式:

{resourceName}-{podIndex}.{resourceName}-{podIndex}-svc.{namespace}.svc.cluster.local

例如: mdb-rs-1.mdb-rs-1-svc.ns.svc.cluster.local

注意

您必须仅使用表中指定的已知占位符值,并确保占位符不使用空值或 null 值。 此外,您不能将特定于多 Kubernetes 集群部署的占位符用于单个MongoDB资源部署。

否则,Kubernetes Operator 将返回错误。 例如,您可能会遇到以下错误消息:

error replacing placeholders in map with key=external-dns.alpha.kubernetes.io/hostname, value={resourceName}-{podIndex}-{unknownPlaceholder}.{clusterName}-{clusterIndex}.example.com: missing values for the following placeholders: {clusterName}, {clusterIndex}, {unknownPlaceholder}``

例子

以下示例指定了{resourceName} 、 {podIndex}和{namespace}占位符:

apiVersion: mongodb.com/v1
kind: MongoDB
metadata:
name: mdb-rs
namespace: ns
spec:
replicas: 3
externalAccess:
externalService:
annotations:
external-dns.alpha.kubernetes.io/hostname: {resourceName}-{podIndex}-{namespace}.example.com

Kubernetes Operator 会根据每个占位符的正确值自动填充外部服务的注释。 例如:

mdb-rs-0-svc-external:
annotations:
external-dns.alpha.kubernetes.io/hostname: mdb-rs-0-ns.example.com
mdb-rs-1-svc-external:
annotations:
external-dns.alpha.kubernetes.io/hostname: mdb-rs-1-ns.example.com
mdb-rs-2-svc-external:
annotations:
external-dns.alpha.kubernetes.io/hostname: mdb-rs-2-ns.example.com
spec.externalAccess.externalService.spec

类型:集合

ServiceSpec 的配置。要学习;了解详情,请参阅 spec.externalAccess.externalService。

spec.applicationDatabase.memberConfig

类型:对象数组

MongoDB Ops Manager部署中每个应用程序数据库副本集成员的规范。

重要

If you set spec.topology to MultiCluster, use spec.applicationDatabase.clusterSpecList.memberConfig instead of spec.applicationDatabase.memberConfig. In a multi-cluster Ops Manager deployment, the Kubernetes Operator ignores all parameters under spec.applicationDatabase.memberConfig.

memberConfig列表中的元素数量必须等于spec.applicationDatabase.members 。

memberConfig列表中元素的顺序必须反映副本集成员的顺序。 示例,大量的第一个元素会影响索引0的 Pod,第二个元素会影响索引1的 Pod,依此类推。

例子

请考虑以下应用程序数据库的三成员副本集的示例规范:

spec:
applicationDatabase:
memberConfig:
- votes: 1
priority: "0.5"
tags:
tag1: "value1"
environment: "prod"
- votes: 1
priority: "1.5"
tags:
tag2: "value2"
environment: "prod"
- votes: 0
priority: "0"
tags:
tag2: "value2"
environment: "prod"
spec.applicationDatabase.memberConfig.priority

类型:字符串

表示应用程序数据库副本集成员成为主节点 (primary node in the replica set)节点的相对可能性的数字。

  • 要增加副本集节点成为主节点的相对可能性,请指定较高的 priority 值。

  • 要降低副本集节点成为主节点的相对可能性,请指定较低的 priority 值。

例如,memberConfig.priority 为 1.5 的成员比 memberConfig.priority 为 0.5 的成员更有可能成为主节点。

A member with a memberConfig.priority of 0 is ineligible to become the primary. To learn more, see Member Priority.

spec.applicationDatabase.memberConfig.tags

类型:地图

Map of replica set tags for directing read and write operations to specific members of your Application Database replica set.

spec.applicationDatabase.memberConfig.votes

类型:数字

Determines whether an Application Database replica set member can vote in an election. Set to 1 to allow the member to vote. Set to 0 to exclude the member from an election.

spec.applicationDatabase.passwordSecretKeyRef.name

类型:字符串

包含 Ops Manager 数据库用户mongodb-ops-manager密码的密钥名称。 Ops Manager 使用此密码对应用程序数据库进行身份验证。

spec.applicationDatabase.passwordSecretKeyRef.key

类型:字符串

密钥中包含 Ops Manager 数据库用户mongodb-ops-manager密码的字段名称。 Ops Manager 使用此密码对应用程序数据库进行身份验证。

默认值为 password。

spec.applicationDatabase.security.certsSecretPrefix

类型:字符串

您创建的Kubernetes密钥的前缀文本,其中包含应用程序数据库的 TLS 密钥和证书。

您必须将密钥命名为<prefix>-<metadata.name>-db-cert 。

要了解如何将 Ops Manager 实例配置为通过HTTPS运行,请参阅部署 Ops Manager 资源。

spec.applicationDatabase.security.tls.ca

类型:字符串

包含应用程序数据库的 CA文件的Kubernetes ConfigMap 的名称。

重要

spec.applicationDatabase.security.tls.ca is required if you use a custom CA to sign your Application Database's TLS certificates.

Kubernetes Operator 要求您在 ConfigMap 中将应用程序数据库的证书命名为ca-pem 。

当 spec.backup.s3OpLogStores.customCertificate 或spec.backup.s3Stores.customCertificate设立为 true 时,本节中指定的 CA 还用于为 S3存储配置自定义 TLS 证书。

此CA签署的证书:

  • 应用程序数据库副本集成员用于相互通信,以及

  • MongoDB Ops Manager用于与应用程序数据库副本集进行通信。

警告

您必须拼接您的自定义 CA 文件和来自 downloads.mongodb.com 的整个 TLS 证书链,以防止 MongoDB Ops Manager 在应用程序数据库重启时变得无法运行。

spec.applicationDatabase.security.tls.enabled

重要

spec.security.applicationDatabase.tls.enabled 已弃用,并将在未来版本中删除。要启用 TLS,请为 spec.security.applicationDatabase.certsSecretPrefix 设置提供一个值。

使用TLS证书对MongoDB Ops Manager和应用程序数据库之间的通信进行加密。

将 Prometheus 与应用程序数据库结合使用时,以下设置应用:

spec.applicationDatabase.prometheus

类型:数组

可选。列表,其中包含用于向 Prometheus 公开指标的参数。

spec.applicationDatabase.prometheus.metricsPath

类型:字符串

默认值:"/metrics"

可选。人类可读的字符串,指示指标终结点的路径。如果不指定此设置,则使用默认设置。

spec.applicationDatabase.prometheus.passwordSecretRef

类型:对象

包含基本HTTP身份验证密钥详细信息的条件对象。如果要将 Prometheus 与应用程序数据库一起使用,则必须指定此设置。

spec.applicationDatabase.prometheus.passwordSecretRef.key

类型:字符串

默认值:"password"

可选。人类可读的字符串,用于标识存储基本HTTP身份验证密码的密钥中的密钥。如果不指定此设置,则应用默认。

spec.applicationDatabase.prometheus.passwordSecretRef.name

类型:字符串

可选的

人类可读标签,用于标识包含基本HTTP身份验证密码的密钥。如果要将 Prometheus 与应用程序数据库一起使用,则必须指定此设置。

spec.applicationDatabase.prometheus.port

类型:整型

默认值:9216

可选。数字,用于标识指标终结点将绑定的端口。如果不指定此设置,则使用默认设置。

spec.applicationDatabase.prometheus.tlseSecretKeyRef

类型:对象

可选。包含 TLS身份验证密钥详细信息的对象。

spec.applicationDatabase.prometheus.tlseSecretKeyRef.key

类型:字符串

默认值:"password"

可选。人类可读的字符串,用于标识存储 TLS身份验证密码的密钥中的密钥。如果不指定此设置,则应用默认。

spec.applicationDatabase.prometheus.tlseSecretKeyRef.name

类型:字符串

有条件。人类可读标签,用于标识包含 TLS身份验证密码的密钥。如果要将 Prometheus 与应用程序数据库一起使用并且想要使用 TLS 身份验证,则必须指定此设置。

spec.applicationDatabase.prometheus.username

类型:字符串

有条件。 人类可读标签,用于标识用户以进行基本 HTTP 身份验证。 如果要将 Prometheus 与应用程序数据库一起使用,则必须指定此设置。

除了所需的 MongoDB Ops Manager 设置之外,本部分还介绍了多集群MongoDB Ops Manager部署必须使用的MongoDB Ops Manager 。

spec.clusterSpecList.members

类型:整型

Conditional. The number of Ops Manager members in the Ops Manager cluster in a multi-Kubernetes cluster MongoDB deployment. When you set spec.topology to MultiCluster, you must specify the value for this parameter. Omit this parameter for single-cluster deployments. If you set this parameter to zero, this removes this Ops Manager member cluster from the list of member clusters in the multi-Kubernetes cluster of Ops Manager instances.

spec.topology

类型:字符串

KubernetesMongoDB Ops Manager资源的 部署类型。

  • 值为SingleCluster或MultiCluster 。 如果省略,则默认值为SingleCluster 。

  • 如果指定MultiCluster :

MongoDB Ops Manager资源还可以使用以下特定于多集群MongoDB Ops Manager部署的设置:

spec.clusterSpecList

类型:集合

Conditional. Details of selected Kubernetes member clusters in a multi-Kubernetes cluster where you intend to deploy Ops Manager or Backup Daemon instances. See also the example of the resource specification.

spec.clusterSpecList.clusterName

类型:字符串

可选。多 Kubernetes集群MongoDB 部署中成员Kubernetes集群的名称,在该部署中, Kubernetes Operator 的MongoDB控制器为MongoDB Ops Manager或备份守护程序进程调度StatefulSet。

spec.clusterSpecList.clusterDomain

类型:字符串

可选。特定Ops Manager成员集群的 spec.clusterDomain 覆盖。如果省略此值,则默认为 spec.clusterDomain 中设立的值。 Kubernetes为每个 Pod 分配一个 FQDN。 Kubernetes Operator 使用提供的 clusterDomain 值计算每个 Pod 的 FQDN。 Kubernetes不提供用于查询这些主机名的API 。

spec.clusterSpecList.configuration

类型:集合

Optional. Ops Manager configuration properties that override properties you set in spec.configuration for the specific cluster. See Ops Manager Configuration Settings for property names and descriptions. Each property takes a value of type string. For example, setting these properties allows you to change environment variables that you must pass to Ops Manager and the Backup Daemon in that particular member cluster.

If you omit specifying values, defaults to the values set in spec.configuration.

spec.clusterSpecList.jvmParameters

类型:字符串数组

可选。 传递给该成员集群的 和备份守护程序实例的 JVM 参数。MongoDB Ops Manager

spec.clusterSpecList.externalConnectivity

类型:集合

Optional. Configuration object that enables external connectivity to Ops Manager for the specific cluster. This is an override for spec.externalConnectivity for the specific cluster.

指定此参数的值以更改MongoDB Ops Manager应用程序在不同集群中向外部公开的方式。 示例,如果您在不同云提供商的 节点上部署MongoDB Ops Manager Kubernetes,则可能需要为此参数指定特定于云提供商的值。

如果设置此参数:

  • The Kubernetes Operator doesn't use spec.externalConnectivity values for this member Ops Manager cluster.

  • Kubernetes Operator 创建一个名为 <om-name>-svc-ext 的Kubernetes服务,该服务允许来自Kubernetes集群外部的流量到达此成员集群上的MongoDB Ops Manager应用程序。

If you omit this parameter, the Kubernetes Operator uses values from spec.externalConnectivity for this member cluster.

spec.clusterSpecList.statefulSet.spec

类型:集合

可选。 Kubernetes Operator 的MongoDB控制器为多 Kubernetes集群Ops Manager部署中的特定成员集群创建的 StatefulSet 规范。此参数将覆盖 spec.statefulSet.spec。如果省略, Kubernetes Operator 将使用 spec.statefulSet.spec 中的值。示例,您可以使用此参数为多 Kubernetes集群MongoDB 部署中的每个Ops Manager集群指定不同的存储值。

要查看可以向 spec.clusterSpecList.statefulSet.spec 添加哪些字段,请参阅Kubernetes文档中的 StatefulSetSpec v1 apps。

spec.clusterSpecList[*].backup

可选。 覆盖在spec.backup下为该特定成员集群指定的值的备份设置。

  • You can set these values only if spec.backup.enabled is set to true.

  • 如果您省略为此参数设置任何值,则它们默认为spec.backup下的设置中指定的值。

  • 此覆盖并不支持所有备份设置。 您无法覆盖以下备份设置,因为它们会全局应用于所有成员集群(如果在spec.backup下指定):

    • externalServiceEnabled

    • headDB

    • opLogStores

    • blockStores

    • s3Stores

    • fileSystemStores

    • queryableBackupSecretRef

    • encryption

spec.clusterSpecList[*].backup.members

类型:整型

Optional. Override for spec.backup.members. The number of Backup Daemon instances to deploy in this cluster. if you omit this value or provide a value of 0, the Kubernetes Operator won't deploy Backup Daemon instances in a particular member cluster.

spec.clusterSpecList[*].backup.assignmentLabels

类型:字符串数组

Optional. Override for spec.backup.assignmentLabels. If specified, the Kubernetes Operator uses the values you specify in this override for all Backup Daemon instances in a particular member cluster. If you omit values for this parameter, the values default to those specified in spec.backup.assignmentLabels for all Backup Daemon instances in a member cluster.

spec.clusterSpecList[*].backup.jvmParameters

类型:字符串数组

Optional. Override for spec.backup.jvmParameters. Allows you to customize the JVM value for Backup Daemon instances in a particular member cluster.

spec.clusterSpecList[*].backup.statefulSet

类型:字符串

可选。覆盖 spec.backup.statefulSet.spec。允许自定义特定成员集群中备份守护程序的值。要查看可以向 spec.clusterSpecList[*].backup.statefulSet 添加哪些字段,请参阅Kubernetes文档中的 StatefulSetSpec v1 apps。

本部分介绍必须用于应用程序数据库的多集群MongoDB Ops Manager部署的特定设置。

spec.applicationDatabase.clusterSpecList

类型:集合

多 Kubernetes集群MongoDB 部署中选定的Kubernetes成员集群的详细信息,这些集群提供服务托管应用程序数据库的节点。

spec.applicationDatabase.clusterSpecList.clusterName

类型:字符串

多 Kubernetes集群MongoDB 部署中成员Kubernetes集群的名称,其中MongoDB Controllers for Kubernetes Operator 为应用程序数据库调度 StatefulSet。

重要

You can't convert a single cluster Ops Manager instance to a multi-Kubernetes cluster MongoDB deployment instance by modifying the topology and the clusterSpecList settings in the CRD.

spec.applicationDatabase.clusterSpecList.members

类型:数字

给定成员集群中的 StatefulSet 节点数。 成员集群是多 Kubernetes 集群 MongoDB 部署中托管应用程序数据库的成员集群之一。

spec.applicationDatabase.topology

类型:字符串

应用程序数据库的 Kubernetes 部署类型。

  • 值为SingleCluster或MultiCluster 。 如果省略,则默认值为SingleCluster 。

  • 如果指定MultiCluster ,则必须至少指定一名成员

  • cluster on which you want to deploy the Application Database using the clusterSpecList, clusterName, members parameters.

  • 如果您指定MultiCluster , Kubernetes Operator 将忽略您为spec.applicationDatabase.members字段设立的值。

要了解更多信息,请参阅多集群资源规范示例。

本部分介绍可用于应用程序数据库的多集群MongoDB Ops Manager部署的特定设置。

spec.applicationDatabase.clusterSpecList.externalAccess

类型:字符串

用于向外部公开您的副本集部署的外部域。

默认情况下,每个副本集节点使用 Kubernetes Pod 的FQDN (*.svc.cluster.local) 作为默认主机名。不过,如果您将一个外部域添加到该设置中,副本集将使用作为指定域的子域的主机名。此主机名使用以下格式:

<replica-set-name>-<cluster-idx>-<pod-idx>.<externalDomain>

例如:

multi-replica-set-0-1.cluster-0.example.com

重要

仅当在没有服务网格的情况下部署应用程序数据库时,才使用此设置。请参阅不使用服务网格的多集群MongoDB Ops Manager。

spec.applicationDatabase.clusterSpecList.memberConfig

类型:字符串数组

多集群MongoDB Ops Manager部署中每个应用程序数据库副本集节点的规范。

重要

If you set spec.topology to SingleCluster, use spec.applicationDatabase.memberConfig instead of spec.applicationDatabase.clusterSpecList.memberConfig.

The number of elements in the memberConfig list must equal spec.applicationDatabase.clusterSpecList.members.

memberConfig列表中元素的顺序必须反映副本集成员的顺序。 示例,大量的第一个元素会影响索引0的 Pod,第二个元素会影响索引1的 Pod,依此类推。

例子

请考虑以下应用程序数据库的三成员副本集的示例规范:

spec:
replicas: 3
version: 8.0.0
backup:
enabled: true
storage:
resources:
requests:
storage: 10Gi
storageClassName: standard
applicationDatabase:
clusterSpecList:
- name: appdb
members: 3
memberConfig:
- votes: 1
priority: "0.5"
tags:
tag1: "value1"
environment: "prod"
- votes: 1
priority: "1.5"
tags:
tag2: "value2"
environment: "prod"
- votes: 0
priority: "0"
tags:
tag2: "value2"
environment: "prod"
spec.applicationDatabase.clusterSpecList.memberConfig.priority

类型:字符串

表示应用程序数据库副本集成员成为主节点 (primary node in the replica set)节点的相对可能性的数字。

  • 要增加副本集节点成为主节点的相对可能性,请指定较高的 priority 值。

  • 要降低副本集节点成为主节点的相对可能性,请指定较低的 priority 值。

例如,memberConfig.priority 为 1.5 的成员比 memberConfig.priority 为 0.5 的成员更有可能成为主节点。

A member with a memberConfig.priority of 0 is ineligible to become the primary. To learn more, see Member Priority.

spec.applicationDatabase.clusterSpecList.memberConfig.tags

类型:地图

Map of replica set tags for directing read and write operations to specific members of your Application Database replica set.

spec.applicationDatabase.clusterSpecList.memberConfig.votes

类型:数字

Determines whether an Application Database replica set member can vote in an election. Set to 1 to allow the member to vote. Set to 0 to exclude the member from an election.