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 部署的资源规范:
1 apiVersion: mongodb.com/v1 2 kind: MongoDBOpsManager 3 metadata: 4 name: om 5 spec: 6 topology: SingleCluster # optional, SingleCluster by default 7 opsManagerURL: https://link.to.configured.load-balancer.example.com # optional OM URL for the operator 8 replicas: 1 9 version: "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
1 apiVersion: mongodb.com/v1 2 kind: MongoDBOpsManager 3 metadata: 4 name: om 5 spec: 6 topology: MultiCluster # optional, SingleCluster by default 7 opsManagerURL: https://link.to.configured.lb.example.com # optional OM URL for the operator 8 clusterSpecList: # optional ClusterSpecOMItem list, the type is different than ClusterSpecItem for AppDB and MongoDB 9 - clusterName: cluster-1 # required 10 replicas: 1 # required, OM application replicas 11 # optional parameters to override those defined at MongoDBOpsManager level 12 clusterDomain: cluster-1.example.com # optional, default cluster.local 13 jvmParameters: ["-Xmx4352m","-Xms4352m"] 14 externalConnectivity: # optional to override 15 type: LoadBalancer 16 port: 9090 17 annotations: 18 key: value 19 statefulSet: # StatefulSetSpecWrapper override 20 spec: {} 21 metadata: {} 22 configuration: 23 automation.versions.source: mongodb 24 mms.adminEmailAddr: cloud-manager-support@mongodb.com 25 backup: # MongoDBOpsManagerBackup, optional, we only support a subset of fields 26 members: 1 # backup daemon replicas, optional, default=1 27 assignmentLabels: [] # assignment labels to override 28 jvmParameters: ["-Xmx4352m","-Xms4352m"] # optional 29 statefulSet: # mdbc.StatefulSetConfiguration, optional to override for backup daemon 30 spec: {} 31 metadata: {} 32 - clusterName: cluster-2 33 replicas: 1 34 35 .... 36 37 replicas: 1 38 version: "8.0.0" 39 adminCredentials: ops-manager-admin-secret 40 configuration: 41 mms.fromEmailAddr: admin@example.com 42 mms.security.allowCORS: "false" 43 backup: 44 enabled: true 45 encryption: 46 kmip: 47 server: 48 url: kmip.corp.mongodb.com:5696 49 ca: mongodb-kmip-certificate-authority-pem 50 headDB: 51 storage: "30Gi" 52 labelSelector: 53 matchLabels: 54 app: my-app 55 opLogStores: 56 - name: oplog1 57 # Sets labels for the oplog store. 58 assignmentLabels: ["test1", "test2"] 59 mongodbResourceRef: 60 name: my-oplog-db 61 mongodbUserRef: 62 name: my-oplog-user 63 s3Stores: 64 - name: s3store1 65 # Sets labels for the S3 store. 66 assignmentLabels: ["test1", "test2"] 67 68 mongodbResourceRef: 69 name: my-s3-metadata-db 70 mongodbUserRef: 71 name: my-s3-store-user 72 s3SecretRef: 73 name: my-s3-credentials 74 pathStyleAccessEnabled: true 75 s3BucketEndpoint: s3.region.amazonaws.com 76 s3BucketName: my-bucket 77 security: 78 tls: 79 ca: issuer-ca 80 applicationDatabase: 81 passwordSecretKeyRef: 82 name: om-db-user-secret 83 key: password 84 version: "8.0.0-ubi8" 85 topology: MultiCluster 86 clusterSpecList: 87 - clusterName: cluster1.example.com 88 members: 4 89 - clusterName: cluster2.example.com 90 members: 3 91 - clusterName: cluster3.example.com 92 members: 2 93 security: 94 certsSecretPrefix: appdb 95 tls: 96 ca: issuer-ca
MongoDB Ops Manager所需设置
本部分介绍必须用于所有 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
SingleClusterinspec.topology, this parameter is required. The mimimum accepted value is1.If you specify
MultiClusterinspec.topology, this parameter is ignored.
MongoDB Ops Manager可选设置
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
emptyDirvolume, consider overriding theemptyDirvolume with a Persistent Volume to prevent pod crashes. To learn more, seespec.statefulSet.spec.template.spec.volumes.
spec.opsManagerURL类型:字符串
可选。 Operator 中URL MongoDB Ops Manager资源的 ,例如:Kubernetes
https://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.opsManagerURLwith 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 thespec.opsManagerURLto directly connect to Ops Manager instances and to configure Ops Manager and Application Database deployments. The Kubernetes Operator doesn't use thespec.opsManagerURLto manage particular MongoDB databases.Change the
spec.opsManagerURLparameter 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类型:字符串
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.caConfigMap 的名称Kubernetes ,其中包含 的自定义 CA MongoDB Ops Manager文件。
重要
spec.security.tls.cais 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 中的
dataKubernetes 卷使用持久卷。默认下,
dataKubernetes 卷使用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.typeis present.接受的值为:
LoadBalancer和NodePort。 如果您的云提供商支持,则建议使用LoadBalancer。 使用NodePort进行本地部署。
spec.externalConnectivity.port类型:整型
指示 Kubernetes 服务公开 Ops Manager 应用程序的端口应用于外部流量的值。
If
spec.externalConnectivity.typeisNodePort:Kubernetes 服务通过此端口向外部流量公开 Ops Manager 应用程序。
If you don't provide a
spec.externalConnectivity.portvalue, 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.typeisLoadBalancer:云提供商创建的负载均衡器资源通过此端口公开 Ops Manager 应用程序。
If you don't provide a
spec.externalConnectivity.portvalue, 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 创建
LoadBalancerKubernetes 服务时使用的 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.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.credentialsmust have theGlobal Ownerrole.
spec.backup.encryption.kmip.server.ca类型:字符串
人类可读标签,用于标识包含用于 KMIP 身份验证的 CA 证书 () 的条目的 ConfigMap。
ca.pem
spec.backup.encryption.kmip.server.url类型:字符串
KMIP 服务器的 URL
hostname.port192.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.mongodbResourceRef.name类型:字符串
如果启用备份,则为必填项。 您创建的用于存储oplog切片的
MongoDB资源或MongoDBMultiCluster资源的名称。 您必须将此资源部署在与MongoDB Ops Manager资源相同的命名空间中。Oplog 数据库仅支持
SCRAM身份验证机制。 您无法启用其他身份验证机制。如果在 oplog 数据库上启用
SCRAM身份验证,则必须:创建 MongoDB 资源以将 Ops Manager 连接到 oplog 数据库。
Specify the
nameof 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
nameof 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
namefield, 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 中导致不可预知的结果。
S3 设置
您可以将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.customCertificateSecretRefsinstead.指示是否将 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
nameand thekey. If you specify multiple secrets, Kubernetes Operator uses all the certificates in the specified secrets.如果您不提供此设置,Ops Manager 将使用 Ops Manager 使用的JVM默认信任存储。
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 toFalse, 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.mongodbResourceRef.name类型:字符串
您创建的 MongoDB 数据库资源的名称,该资源用于存储用于 S3 oplog 存储的元数据。您必须在与MongoDB Ops Manager资源相同的命名空间中部署此数据库资源。
注意
省略此设置,以使用应用程序数据库存储 S3 oplog 存储的元数据。
If you omit this setting, you must also omit the
spec.backup.s3OpLogStores.mongodbUserRef.namesetting. The Kubernetes Operator handlesSCRAMuser authentication internally.如果您对此数据库启用
SCRAM身份验证,则必须:创建 MongoDB 用户资源以将 Ops Manager 连接到数据库。
Specify the
nameof 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
s3RegionOverridefield.
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.customCertificateSecretRefsinstead.指示是否使用应用程序数据库的证书
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
nameand thekey. If you specify multiple secrets, Kubernetes Operator uses all the specified secrets.如果您不提供此设置,Kubernetes 操作符将使用 Ops Manager 使用的Java虚拟机(JVM)默认信任存储进行备份。
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 toFalse, 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.namesetting. The Kubernetes Operator handlesSCRAMuser authentication internally.如果您对此数据库启用
SCRAM身份验证,则必须:创建 MongoDB 用户资源以将 Ops Manager 连接到数据库。
Specify the
nameof 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.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
s3RegionOverridefield.
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结尾。注意
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
featureCompatibilityVersionparameter underspec.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 内自动化代理日志记录的级别。接受的值包括:
DEBUGINFOWARNERRORFATAL
spec.applicationDatabase.agent.<component>.logRotate类型:对象
将组件替换为以下值之一:
mongodmonitoringAgent
MongoDB configuration object for rotating the MongoDB logs of a process. To use the
agent.<component>.logRotatesettings, you must setsystemLog.destinationtofilebecause you can't use theagent.<component>.logRotatesettings 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
emptyDirvolume, consider overriding theemptyDirvolume with a Persistent Volume to prevent pod crashes. To learn more, seespec.statefulSet.spec.template.spec.volumes.
spec.applicationDatabase.agent.mongod.logRotate.numTotal类型:整型
默认值:
0Total number of log files that Ops Manager retains. If you don't change the default, Ops Manager bases rotation on your other
agent.<compenet>.logRotatesettings.
spec.applicationDatabase.agent.mongod.logRotate.numUncompressed类型:整型
默认值:
5保持未压缩状态的日志文件总数的最大数量,包括当前日志文件。
spec.applicationDatabase.agent.mongod.logRotate.percentOfDiskspace类型:数字
默认值:
0.02Maximum 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类型:数字
将组件替换为以下值之一:
mongodmonitoringAgent
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
sizeThresholdMBor thelogRotate.timeThresholdHrslimit.
spec.applicationDatabase.agent.<component>.logRotate.timeThresholdHrs类型:整型
将组件替换为以下值之一:
mongodmonitoringAgent
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
timeThresholdHrsor thelogRotate.sizeThresholdMlimit.
spec.applicationDatabase.agent.mongod.auditlogRotate.numTotal类型:整型
默认值:
0Total 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.auditlogRotatesettings.
spec.applicationDatabase.agent.mongod.auditlogRotate.numUncompressed类型:整型
默认值:
5保持未压缩状态的Atlas 审核日志文件总数的最大数量,包括当前Atlas 审核日志文件。
spec.applicationDatabase.agent.mongod.auditlogRotate.percentOfDiskspace类型:数字
默认值:
0.02Maximum 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
sizeThresholdMBor theauditlogRotate.timeThresholdHrslimit.
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
timeThresholdHrsor theauditlogRotate.sizeThresholdMlimit.
spec.applicationDatabase.agent.startupOptions类型:对象
用于启动选项的 MongoDB 配置对象。 有关可用字段,请参阅MongoDB Agent设置。
spec.applicationDatabase.agent.systemLog.path类型:字符串
默认:
/var/log/mongodb-mms-automation/mongodb.logThe path of the log file to which
mongodormongosshould 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类型:布尔值
默认:
falseWhen
true,mongosormongodappends new entries to the end of the existing log file when themongosormongodinstance restarts. Without this option,mongodwill 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
fileorsyslog. If you specifyfile, you must also specifysystemLog.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外部服务的名称。您无法更改此值。
TypeLoadBalancer创建外部 LoadBalancer 服务。
Port<Port Number>A port for
mongod.publishNotReadyAddresstrue指定即使 Pod 尚未准备就绪,也会创建 DNS 记录。对于任何数据库Pod,请勿设立为
false。
spec.externalAccess.externalService类型:集合
当您设立
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.externalDomainif specified. Otherwise, equal to the domain used for themongodprocess FQDN.例如,对于进程主机名
mdb-rs-1.example.com,example.com是域名。{mongodProcessFQDN}The
mongodprocess 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.topologytoMultiCluster, usespec.applicationDatabase.clusterSpecList.memberConfiginstead ofspec.applicationDatabase.memberConfig. In a multi-cluster Ops Manager deployment, the Kubernetes Operator ignores all parameters underspec.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.priorityof0is 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
1to allow the member to vote. Set to0to 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.cais 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 设置
将 Prometheus 与应用程序数据库结合使用时,以下设置应用:
spec.applicationDatabase.prometheus.metricsPath类型:字符串
默认值:
"/metrics"可选。人类可读的字符串,指示指标终结点的路径。如果不指定此设置,则使用默认设置。
spec.applicationDatabase.prometheus.passwordSecretRef类型:对象
包含基本HTTP身份验证密钥详细信息的条件对象。如果要将 Prometheus 与应用程序数据库一起使用,则必须指定此设置。
spec.applicationDatabase.prometheus.passwordSecretRef.name类型:字符串
可选的
人类可读标签,用于标识包含基本HTTP身份验证密码的密钥。如果要将 Prometheus 与应用程序数据库一起使用,则必须指定此设置。
多集群设置
MongoDB Ops Manager所需设置
除了所需的 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.topologytoMultiCluster, 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:将
MongoDBMultiCluster资源添加到监视的资源列表中。 这向 Kubernetes Operator 表明它应该在多 Kubernetes 集群模式下工作,并执行处理多 Kubernetes 资源所需的配置动作。Specify at least one member cluster on which you want to deploy Ops Manager, using
spec.clusterSpecListand its nestedspec.clusterSpecList.clusterNameandspec.clusterSpecList.membersparameters.如果您指定
MultiCluster, Kubernetes Operator 将忽略您为spec.members设立的任何值。 请参阅资源规范的示例。
MongoDB Ops Manager可选设置
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.
When you set
spec.topologytoMultiCluster, you must specify the value forspec.clusterSpecList.members. All other parameters underspec.clusterSpecListare optional.When you set
spec.topologytoSingleCluster, the Kubernetes Operator ignores all parameters underspec.clusterSpecList.
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.configurationfor the specific cluster. See Ops Manager Configuration Settings for property names and descriptions. Each property takes a value of typestring. 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
If you specify this parameter, its values override the values specified in
spec.jvmParameters. For example values, see the example of the resource specification.If you omit this parameter, values from the
spec.jvmParametersare used for the Ops Manager and Backup Daemon instances in this member cluster.
spec.clusterSpecList.externalConnectivity类型:集合
Optional. Configuration object that enables external connectivity to Ops Manager for the specific cluster. This is an override for
spec.externalConnectivityfor the specific cluster.指定此参数的值以更改MongoDB Ops Manager应用程序在不同集群中向外部公开的方式。 示例,如果您在不同云提供商的 节点上部署MongoDB Ops Manager Kubernetes,则可能需要为此参数指定特定于云提供商的值。
如果设置此参数:
The Kubernetes Operator doesn't use
spec.externalConnectivityvalues 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.externalConnectivityfor 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.enabledis set totrue.如果您省略为此参数设置任何值,则它们默认为
spec.backup下的设置中指定的值。此覆盖并不支持所有备份设置。 您无法覆盖以下备份设置,因为它们会全局应用于所有成员集群(如果在
spec.backup下指定):externalServiceEnabledheadDBopLogStoresblockStoress3StoresfileSystemStoresqueryableBackupSecretRefencryption
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 of0, 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 inspec.backup.assignmentLabelsfor 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
topologyand theclusterSpecListsettings 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,membersparameters.如果您指定
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.topologytoSingleCluster, usespec.applicationDatabase.memberConfiginstead ofspec.applicationDatabase.clusterSpecList.memberConfig.The number of elements in the
memberConfiglist must equalspec.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.priorityof0is 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
1to allow the member to vote. Set to0to exclude the member from an election.