您可以使用 Kubernetes 操作符将 Ops Manager 作为资源部署在 Kubernetes container中。
Considerations
以下注意事项适用:
加密连接
配置 Ops Manager 部署时,必须选择是通过HTTPS还是HTTP运行连接。
以下HTTPS过程:
建立与 Ops Manager 应用程序之间的TLS加密连接。
在应用程序数据库的副本集成员之间建立TLS加密连接。
TLS 加密需要有效证书。
以下HTTP过程:
不对与 Ops Manager 应用程序之间的连接进行加密。
不加密应用程序数据库副本集成员之间的连接。
设置要求较少。
When running over HTTPS, Ops Manager runs on port 8443 by default.
根据您是否要使用TLS加密 Ops Manager 和应用程序数据库连接,选择相应的标签页。
先决条件
完成先决条件。
阅读注意事项。
Create one TLS certificate for the Application Database's replica set.
此TLS证书需要以下属性:
DNS 名称
Ensure that you add SANs or Subject Names for each Pod that hosts a member of the Application Database replica set. The SAN for each pod must use the following format:
<opsmgr-metadata.name>-db-<index>.<opsmgr-metadata.name>-db-svc.<namespace>.svc.cluster.local 密钥用法
确保 TLS 证书包含以下密钥用法 (5280):
"服务器 auth"
"client auth"
重要
Kubernetes Operator 使用 kubernetes.io/tls secrets 来存储Ops Manager和MongoDB资源的 TLS 证书和私钥。从Kubernetes Operator 版本 1.17.0 开始, Kubernetes Operator 不支持存储为不透明密钥的连接 PEM 文件。
在部署MongoDB Ops Manager资源之前,请确保对MongoDB Ops Manager Ops Manager资源进行规划:
步骤
此过程适用于在单个MongoDB Ops Manager Kubernetes集群中部署 实例,以及在多集群部署中的MongoDB Ops Manager Operator 集群上部署 。如果要在多个MongoDB Ops Manager KubernetesKubernetesMongoDB Ops Manager 集群上部署 MongoDB Ops 的多个实例,请参阅在多个Kubernetes 集群 部署 资源。
请按照以下步骤部署 Ops Manager 资源以通过HTTPS运行,并使用TLS保护应用程序数据库。
将kubectl 配置为默认命名空间。
如果您尚未执行,请运行以下命令,执行所创建命名空间的所有 kubectl 命令。
注意
MongoDB Ops Manager如果要在多 Kubernetes 集群 部署中部署MongoDB 资源:
将
context设置为操作符集群的名称,例如:kubectl config set context "$MDB_CENTRAL_CLUSTER_FULL_NAME"。将
--namespace设置为您用于多 Kubernetes 集群 MongoDB 部署的相同范围,例如:kubectl config --namespace "mongodb"。
kubectl config set-context $(kubectl config current-context) --namespace=<metadata.namespace>
为证书创建密钥。
如果您使用 HashiCorp Vault 作为您的 Secret 存储工具,则可以创建 Vault Secret。
要了解有关 Secret 存储的选项,请参阅配置 Secret 存储。
运行以下命令以创建新 密钥 存储应用程序数据库的 TLS 证书:
kubectl create secret tls <prefix>-<metadata.name>-db-cert \ --cert=<appdb-tls-cert> \ --key=<appdb-tls-key>
为自定义CA证书添加其他证书。
If your Ops Manager TLS certificate is signed by a custom CA, the CA certificate must also contain additional certificates that allow Ops Manager Backup Daemon to download MongoDB binaries from the Internet. To create the TLS certificate(s), create a ConfigMap to hold the CA certificate:
重要
Kubernetes 操作符要求 Ops Manager 证书在 ConfigMap 中命名为mms-ca.crt 。
Obtain the entire TLS certificate chain for Ops Manager from
downloads.mongodb.com. The followingopensslcommand outputs the certificate in the chain to your current working directory, in.crtformat:openssl s_client -showcerts -verify 2 \ -connect downloads.mongodb.com:443 -servername downloads.mongodb.com < /dev/null \ | awk '/BEGIN/,/END/{ if(/BEGIN/){a++}; out="cert"a".crt"; print >out}' Concatenate your CA's certificate file for Ops Manager with the entire TLS certificate chain from
downloads.mongodb.comthat you obtained in the previous step:cat <custom_ca_cert.pem> cert2.crt cert3.crt cert4.crt >> mms-ca.crt 注意
将占位符
<custom_ca_cert.pem>替换为您的自定义 CA 证书 PEM文件。请勿包含
cert1.crt文件,因为不应包含来自MongoDB的服务器证书。
为MongoDB Ops Manager创建 ConfigMap:
kubectl create configmap om-http-cert-ca --from-file="mms-ca.crt"
MongoDB Ops ManagerKubernetes复制以下MongoDB Ops Manager Kubernetes对象示例之一。
更改设置以匹配您的 Ops Manager 和应用程序数据库配置。
1 2 apiVersion: mongodb.com/v1 3 kind: MongoDBOpsManager 4 metadata: 5 name: <myopsmanager> 6 spec: 7 replicas: 1 8 version: <opsmanagerversion> 9 adminCredentials: <adminusercredentials> # Should match metadata.name 10 # in the Kubernetes secret 11 # for the admin user 12 13 externalConnectivity: 14 type: LoadBalancer 15 security: 16 certsSecretPrefix: <prefix> # Required. Text to prefix 17 # the name of the secret that contains 18 # Ops Manager's TLS certificate. 19 tls: 20 ca: "om-http-cert-ca" # Optional. Name of the ConfigMap file 21 # containing the certificate authority that 22 # signs the certificates used by the Ops 23 # Manager custom resource. 24 25 applicationDatabase: 26 topology: SingleCluster 27 members: 3 28 version: "8.0.0-ubi8" 29 security: 30 certsSecretPrefix: <prefix> # Required. Text to prefix to the 31 # name of the secret that contains the Application 32 # Database's TLS certificate. Name the secret 33 # <prefix>-<metadata.name>-db-cert. 34 tls: 35 ca: "appdb-ca" # Optional, unless enabling TLS for |mms|. 36 # Name of the ConfigMap file 37 # containing the certicate authority that 38 # signs the certificates used by the 39 # application database. 40 41 ...
1 2 apiVersion: mongodb.com/v1 3 kind: MongoDBOpsManager 4 metadata: 5 name: <myopsmanager> 6 spec: 7 replicas: 1 8 version: <opsmanagerversion> 9 adminCredentials: <adminusercredentials> # Should match metadata.name 10 # in the Kubernetes secret 11 # for the admin user 12 13 externalConnectivity: 14 type: LoadBalancer 15 security: 16 certsSecretPrefix: <prefix> # Required. Text to prefix 17 # the name of the secret that contains 18 # Ops Manager's TLS certificate. 19 tls: 20 ca: "om-http-cert-ca" # Optional. Name of the ConfigMap file 21 # containing the certificate authority that 22 # signs the certificates used by the Ops 23 # Manager custom resource. 24 25 applicationDatabase: 26 topology: MultiCluster 27 clusterSpecList: 28 - clusterName: cluster1.example.com 29 members: 4 30 - clusterName: cluster2.example.com 31 members: 3 32 - clusterName: cluster3.example.com 33 members: 2 34 version: "8.0.0-ubi8" 35 security: 36 certsSecretPrefix: <prefix> # Required. Text to prefix to the 37 # name of the secret that contains the Application 38 # Database's TLS certificate. Name the secret 39 # <prefix>-<metadata.name>-db-cert. 40 tls: 41 ca: "appdb-ca" # Optional, unless enabling TLS for |mms|. 42 # Name of the ConfigMap file 43 # containing the certicate authority that 44 # signs the certificates used by the 45 # application database. 46 47 ...
打开您的首选文本编辑器,并将对象规范粘贴到新的文本文件中。
配置特定于您的部署的设置。
键 | 类型 | 说明 | 例子 |
|---|---|---|---|
字符串 |
| ||
数字 | 要并行运行的 Ops Manager 实例的数量。 最小有效值为 |
| |
字符串 |
| ||
字符串 |
| ||
| 字符串 | 必需。 包含 Ops Manager TLS证书的密钥名称前缀的文本。 |
|
| 字符串 | Name of the ConfigMap you created to verify your Ops Manager TLS certificates signed using a custom CA. This field is required if you signed your Ops Manager TLS certificates using a custom CA. |
|
| 字符串 | 在Kubernetes外部公开Ops Manager |
|
| 整型 | Ops Manager Application Database副本集的成员数。 |
|
| 字符串 | 必需。 MongoDBOps Manager Application Database应运行的 版本。
重要提示:确保选择兼容的MongoDB Server版本。 兼容版本因MongoDB 数据库资源使用的基础映像而异。 要了解有关 MongoDB 版本控制的更多信息,请参阅 MongoDB 手册中的 MongoDB 版本控制。 | For best results, use the latest available enterprise MongoDB version that is compatible with your Ops Manager version. |
| 字符串 | 可选。 应用程序数据库的 Kubernetes 部署类型。 如果省略,则默认值为 如果您指定 您无法通过修改 CRD 中的 另请参阅资源规范的示例。 |
|
| 字符串 | 必需。 包含应用程序数据库的TLS证书的密钥名称前缀的文本。 |
|
| 字符串 | Name of the ConfigMap you created to verify your application database TLS certificates signed using a custom CA. This field is required if you signed your application database TLS certificates using a custom CA. |
The Kubernetes Operator mounts the CA you add using the |
可选:配置备份设置。
要配置备份,必须启用备份,然后:
选择配置 S3快照存储或块存储。如果同时部署S3快照存储和块存储, Ops Manager会随机选择一个用于备份。
选择配置oplog 存储或 S3 oplog 存储。如果同时部署oplog存储和 S3 oplog存储, Ops Manager会随机选择其中一个用于oplog备份。
键 | 类型 | 说明 | 例子 |
|---|---|---|---|
| 布尔 | 指示备份已启用的标志。 您必须指定 |
|
| 集合 | 头部数据库配置设置的集合。有关集合中各个设置的说明,请参阅 | |
| 字符串 | oplog 存储的名称。 |
|
| 字符串 | S3 oplog存储的名称。 |
|
| 字符串 | oplog 存储的 |
|
| 字符串 | S3 oplog存储的 |
|
如果同时部署S3 快照存储和块存储, Ops Manager会随机选择一个用于备份。
要配置快照存储,请配置以下设置:
键 | 类型 | 说明 | 例子 |
|---|---|---|---|
| 字符串 | S3快照存储的名称。 |
|
| 字符串 |
| |
| 字符串 |
| |
| 字符串 | 存储数据库备份快照的 S3 或 S3 兼容存储桶的名称。 |
|
要配置块存储,请配置以下设置:
可选:为 Ops Manager 部署配置任何其他设置。
将要应用部署的任何可选设置添加到对象规范文件中。
创建你的 Ops Manager 实例。
在 Ops Manager 资源定义的文件名上运行以下kubectl命令:
kubectl apply -f <opsmgr-resource>.yaml
注意
MongoDB Ops Manager如果要在多 Kubernetes集群 部署上部署MongoDB 资源,请运行:
kubectl apply \ --context "$MDB_CENTRAL_CLUSTER_FULL_NAME" \ --namespace "mongodb" -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/master/public/samples/ops-manager/ops-manager-external.yaml
追踪你的 Ops Manager 实例的状态。
要检查 Ops Manager 资源的状态,请调用以下命令:
kubectl get om -o yaml -w
部署资源时,该命令会在status字段下返回类似于以下内容的输出:
status: applicationDatabase: lastTransition: "2022-04-01T09:49:22Z" message: AppDB Statefulset is not ready yet phase: Pending type: "" version: "" backup: phase: "" opsManager: phase: ""
Kubernetes Operator 按以下顺序协调资源:
应用程序数据库。
Ops Manager。
备份。
在前一个资源进入Running阶段之前,Kubernetes 操作符 不会协调某一资源。
在 Ops Manager 经理完成Pending阶段后,如果启用了备份,该命令会在status字段下返回类似于以下内容的输出:
status: applicationDatabase: lastTransition: "2022-04-01T09:50:20Z" members: 3 phase: Running type: ReplicaSet version: "8.0.0-ubi8" backup: lastTransition: "2022-04-01T09:57:42Z" message: The MongoDB object <namespace>/<oplogresourcename> doesn't exist phase: Pending opsManager: lastTransition: "2023-04-01T09:57:40Z" phase: Running replicas: 1 url: https://om-svc.cloudqa.svc.cluster.local:8443 version: "8.0.0"
在配置备份数据库之前,备份将保持Pending状态。
提示
status.opsManager.url字段说明资源的连接URL 。 使用此URL ,您可以从MongoDB Ops Manager Kubernetes集群内部访问 或 使用 ConfigMap 创建项目。
资源完成Pending阶段后,该命令会在status字段下返回类似于以下内容的输出:
status: applicationDatabase: lastTransition: "2022-12-06T18:23:22Z" members: 3 phase: Running type: ReplicaSet version: "8.0.0-ubi8" opsManager: lastTransition: "2022-12-06T18:23:26Z" message: The MongoDB object namespace/oplogdbname doesn't exist phase: Pending url: https://om-svc.dev.svc.cluster.local:8443 version: ""
在配置备份数据库之前,备份将保持Pending状态。
提示
status.opsManager.url字段说明资源的连接URL 。 使用此URL ,您可以从MongoDB Ops Manager Kubernetes集群内部访问 或 使用 ConfigMap 创建项目。
访问 Ops Manager 应用程序。
根据您在 Kubernetes 中将流量路由到 Ops Manager 应用程序的方式,您采取的步骤会有所不同。如果已配置 Kubernetes 操作符 来为您创建 Kubernetes 服务,或者您手动创建了 Kubernetes 服务,请使用以下方法之一访问 Ops Manager 应用程序:
查询您的云提供商以获取负载均衡器服务的FQDN 。 有关详细信息,请参阅云提供商的文档。
打开浏览器窗口,使用负载负载均衡器服务的MongoDB Ops Manager FQDN 和端口号导航到 应用程序。
https://ops.example.com:8443 使用管理员用户凭证登录 Ops Manager。
要了解如何使用第三方服务访问 Ops Manager 应用程序,请参阅您的解决方案的文档。
为 Kubernetes 操作符 创建档案。
要配置凭证,您必须创建MongoDB Ops Manager组织、生成编程API密钥并创建密钥。这些活动遵循“为Kubernetes Operator 创建凭证”页面上的先决条件和过程。
使用ConfigMap创建项目。
要创建项目,请遵循使用 ConfigMap 为每个MongoDB部署创建一个项目页面上的前提条件和步骤。
在项目 ConfigMap 中设置以下字段:
将 ConfigMap 中的
data.baseUrl设置为 Ops Manager 应用程序的URL 。 要查找此URL ,请调用以下命令:kubectl get om -o yaml -w 该命令在
status.opsManager.url字段中返回 Ops Manager 应用程序的 URL,与以下示例类似:status: applicationDatabase: lastTransition: "2022-12-06T18:23:22Z" members: 3 phase: Running type: ReplicaSet version: "8.0.0-ubi8" opsManager: lastTransition: "2022-12-06T18:23:26Z" message: The MongoDB object namespace/oplogdbname doesn't exist phase: Pending url: https://om-svc.dev.svc.cluster.local:8443 version: "" 重要
如果将 Ops Manager 与 Kubernetes Operator 一起部署,且 Ops Manager 将管理部署在 Kubernetes 集群外部的 MongoDB 数据库资源,则必须将
data.baseUrl设置为与 Ops Manager 资源规范中的spec.configuration.mms.centralUrl设置相同的值。要学习;了解更多信息,请参阅管理外部MongoDB部署。
Set
data.sslMMSCAConfigMapto the name of your ConfigMap containing the root CA certificate used to sign the Ops Manager host's certificate. The Kubernetes Operator requires that you name this Ops Manager resource's certificatemms-ca.crtin the ConfigMap.
部署 MongoDB database 资源,完成备份配置。
默认, MongoDB Ops Manager启用备份。 为oplog和快照存储创建MongoDB 数据库资源以完成配置。
在与 Ops Manager 资源相同的命名空间中为 oplog 存储部署MongoDB database资源。
注意
创建此数据库作为三成员副本集。
将资源的
metadata.name与您在 Ops Manager 资源定义中指定的spec.backup.opLogStores.mongodbResourceRef.name进行匹配。在与Ops Manager资源相同的命名空间中为 S3快照存储部署MongoDB 数据库资源。
注意
创建 S3快照存储作为副本集。
将资源的
metadata.name与您在 Ops Manager 资源定义中指定的spec.backup.s3Stores.mongodbResourceRef.name进行匹配。
确认 Ops Manager 资源正在运行。
要检查 Ops Manager 资源的状态,请调用以下命令:
kubectl get om -o yaml -w
当 Ops Manager 运行时,该命令会在status字段下返回类似于以下内容的输出:
status: applicationDatabase: lastTransition: "2022-12-06T17:46:15Z" members: 3 phase: Running type: ReplicaSet version: "8.0.0-ubi8" opsManager: lastTransition: "2022-12-06T17:46:32Z" phase: Running replicas: 1 url: https://om-backup-svc.dev.svc.cluster.local:8443 version: "8.0.0"
有关资源部署状态的信息,请参阅排除 Kubernetes 操作符故障。
请按照以下步骤部署MongoDB Ops Manager资源以通过HTTP运行:
将kubectl 配置为默认命名空间。
如果您尚未执行,请运行以下命令,执行所创建命名空间的所有 kubectl 命令。
注意
MongoDB Ops Manager如果要在多 Kubernetes 集群 部署中部署MongoDB 资源:
将
context设置为操作符集群的名称,例如:kubectl config set context "$MDB_CENTRAL_CLUSTER_FULL_NAME"。将
--namespace设置为您用于多 Kubernetes 集群 MongoDB 部署的相同范围,例如:kubectl config --namespace "mongodb"。
kubectl config set-context $(kubectl config current-context) --namespace=<metadata.namespace>
MongoDB Ops ManagerKubernetes复制以下MongoDB Ops Manager Kubernetes对象示例之一。
更改设置以匹配您的MongoDB Ops Manager配置。
1 2 apiVersion: mongodb.com/v1 3 kind: MongoDBOpsManager 4 metadata: 5 name: <myopsmanager> 6 spec: 7 replicas: 1 8 version: <opsmanagerversion> 9 adminCredentials: <adminusercredentials> # Should match metadata.name 10 # in the secret 11 # for the admin user 12 externalConnectivity: 13 type: LoadBalancer 14 15 applicationDatabase: 16 topology: SingleCluster 17 members: 3 18 version: <mongodbversion> 19 ...
1 2 apiVersion: mongodb.com/v1 3 kind: MongoDBOpsManager 4 metadata: 5 name: <myopsmanager> 6 spec: 7 replicas: 1 8 version: <opsmanagerversion> 9 adminCredentials: <adminusercredentials> # Should match metadata.name 10 # in the Kubernetes secret 11 # for the admin user 12 13 externalConnectivity: 14 type: LoadBalancer 15 16 applicationDatabase: 17 topology: MultiCluster 18 clusterSpecList: 19 - clusterName: cluster1.example.com 20 members: 4 21 - clusterName: cluster2.example.com 22 members: 3 23 - clusterName: cluster3.example.com 24 members: 2 25 version: "8.0.0-ubi8" 26 27 ...
打开您的首选文本编辑器,并将对象规范粘贴到新的文本文件中。
配置上一示例中包含的设置。
键 | 类型 | 说明 | 例子 |
|---|---|---|---|
字符串 | 此Kubernetes MongoDB Ops Manager对象的名称。 资源名称必须少于或等于 44 个字符。 要学习;了解更多信息,请参阅 和有关 |
| |
数字 | 要并行运行的 Ops Manager 实例的数量。 最小有效值为 |
| |
字符串 |
| ||
字符串 |
| ||
| 字符串 | 可选。 在Kubernetes之外公开MongoDB Ops Manager 的Kubernetes服务 ServiceType。 如果不希望 Kubernetes Operator 创建 Kubernetes 服务以将外部流量路由到 Ops Manager 应用程序,请排除 |
|
| 整型 | Ops Manager Application Database副本集的成员数。 |
|
| 字符串 | 必需。 MongoDBOps Manager Application Database应运行的 版本。 对于 MongoDB Community Edition,格式应为 重要提示:确保选择兼容的MongoDB Server版本。 兼容版本因MongoDB 数据库资源使用的基础映像而异。 要了解有关 MongoDB 版本控制的更多信息,请参阅 MongoDB 手册中的 MongoDB 版本控制。 | For best results, use the latest available enterprise MongoDB version that is compatible with your Ops Manager version. |
| 字符串 | 可选。 应用程序数据库的 Kubernetes 部署类型。 如果省略,则默认值为 如果您指定 相反,您必须指定 您无法通过修改 CRD 中的 另请参阅资源规范的示例。 |
|
可选:配置备份设置。
要配置备份,必须启用备份,然后:
Choose to configure an S3 snapshot store or a blockstore. If you deploy both an S3 snapshot store and a blockstore, Ops Manager randomly choses one to use for backup.
Choose to configure an oplog store or an S3 oplog store. If you deploy both an oplog store and an S3 oplog store, Ops Manager randomly choses one of them to use for the oplog backup.
键 | 类型 | 说明 | 例子 |
|---|---|---|---|
| 布尔 | 指示备份已启用的标志。您必须指定 |
|
| 集合 | 头部数据库配置设置的集合。有关集合中各个设置的说明,请参阅 | |
| 字符串 | oplog 存储的名称。 |
|
| 字符串 | Name of the S3 oplog store. |
|
| 字符串 | oplog 存储的 |
|
| 字符串 | S3 oplog存储的MongoDB 数据库资源名称。 |
|
您还必须配置 S3快照存储或块存储。如果同时部署S3快照存储和块存储, Ops Manager会随机选择一个用于备份。
要配置 S3快照存储,请配置以下设置:
键 | 类型 | 说明 | 例子 |
|---|---|---|---|
| 字符串 | Name of the S3 snapshot store. |
|
| 字符串 |
| |
| 字符串 |
| |
| 字符串 | 存储数据库备份快照的 S3 或 S3 兼容存储桶的名称。 |
|
| 字符串 | S3 兼容存储桶所在的区域。仅当 S3 商店的 |
|
要配置块存储,请配置以下设置:
可选:为 Ops Manager 备份配置任何其他设置。
Add any optional settings for backups that you want to apply to your deployment to the object specification file. For example, for each type of backup store, and for Ops Manager backup daemon processes, you can assign labels to associate particular backup backup stores or backup daemon processes with specific projects. Use spec.backup.[*].assignmentLabels elements of the OpsManager resources.
可选:为 Ops Manager 部署配置任何其他设置。
将要应用部署的任何可选设置添加到对象规范文件中。
创建你的 Ops Manager 实例。
在 Ops Manager 资源定义的文件名上运行以下kubectl命令:
kubectl apply -f <opsmgr-resource>.yaml
注意
MongoDB Ops Manager如果要在多 Kubernetes集群 部署上部署MongoDB 资源,请运行:
kubectl apply \ --context "$MDB_CENTRAL_CLUSTER_FULL_NAME" \ --namespace "mongodb" -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/master/public/samples/ops-manager/ops-manager-external.yaml
追踪你的 Ops Manager 实例的状态。
要检查 Ops Manager 资源的状态,请调用以下命令:
kubectl get om -o yaml -w
部署资源时,该命令会在status字段下返回类似于以下内容的输出:
status: applicationDatabase: lastTransition: "2023-04-01T09:49:22Z" message: AppDB Statefulset is not ready yet phase: Pending type: "" version: "" backup: phase: "" opsManager: phase: ""
Kubernetes Operator 按以下顺序协调资源:
应用程序数据库。
Ops Manager。
备份。
在前一个资源进入Running阶段之前,Kubernetes 操作符 不会协调某一资源。
在MongoDB Ops Manager资源完成 Pending 阶段后,如果启用了备份,该命令会在 status 字段下返回类似于以下内容的输出:
status: applicationDatabase: lastTransition: "2023-04-01T09:50:20Z" members: 3 phase: Running type: ReplicaSet version: "8.0.0-ubi8" backup: lastTransition: "2022-04-01T09:57:42Z" message: The MongoDB object <namespace>/<oplogresourcename> doesn't exist phase: Pending opsManager: lastTransition: "2022-04-01T09:57:40Z" phase: Running replicas: 1 url: http://om-svc.cloudqa.svc.cluster.local:8080 version: "8.0.0"
在配置备份数据库之前,备份将保持Pending状态。
提示
status.opsManager.url字段说明资源的连接URL 。 使用此URL ,您可以从MongoDB Ops Manager Kubernetes集群内部访问 或 使用 ConfigMap 创建项目。
访问 Ops Manager 应用程序。
根据您在 Kubernetes 中将流量路由到 Ops Manager 应用程序的方式,您采取的步骤会有所不同。如果已配置 Kubernetes 操作符 来为您创建 Kubernetes 服务,或者您手动创建了 Kubernetes 服务,请使用以下方法之一访问 Ops Manager 应用程序:
查询您的云提供商以获取负载均衡器服务的FQDN 。 有关详细信息,请参阅云提供商的文档。
打开浏览器窗口,使用负载负载均衡器服务的MongoDB Ops Manager FQDN 和端口号导航到 应用程序。
http://ops.example.com:8080 使用管理员用户凭证登录 Ops Manager。
要了解如何使用第三方服务访问 Ops Manager 应用程序,请参阅您的解决方案的文档。
可选:为凭证 Operator 创建Kubernetes。
如果启用了备份,则必须创建MongoDB Ops Manager组织,生成编程API密钥,并在secret-storage-tool中创建密钥。 这些活动遵循“为Kubernetes Operator 创建凭证”页面上的先决条件和过程。
可选:使用 ConfigMap 创建项目。
如果已启用备份,请按照使用 ConfigMap 为每个MongoDB部署创建一个项目页面上的先决条件和过程创建项目。
您必须设立ConfigMap 中的 data.baseUrl 设置为MongoDB Ops Manager应用程序的URL 。 要查找此URL ,请调用以下命令:
kubectl get om -o yaml -w
该命令在status.opsManager.url字段中返回 Ops Manager 应用程序的 URL,与以下示例类似:
status: applicationDatabase: lastTransition: "2022-04-01T10:00:32Z" members: 3 phase: Running type: ReplicaSet version: "8.0.0-ubi8" backup: lastTransition: "2022-04-01T09:57:42Z" message: The MongoDB object <namespace>/<oplogresourcename> doesn't exist phase: Pending opsManager: lastTransition: "2022-04-01T09:57:40Z" phase: Running replicas: 1 url: http://om-svc.cloudqa.svc.cluster.local:8080 version: "8.0.0"
重要
如果将 Ops Manager 与 Kubernetes Operator 一起部署,且 Ops Manager 将管理部署在 Kubernetes 集群外部的 MongoDB 数据库资源,则必须将 data.baseUrl 设置为与 Ops Manager 资源规范中的 spec.configuration.mms.centralUrl 设置相同的值。
要学习;了解更多信息,请参阅管理外部MongoDB部署。
可选:部署MongoDB 数据库资源以完成备份配置。
如果已启用 备份 ,请为 和快照存储创建MongoDB database oplog资源以完成配置。
在与 Ops Manager 资源相同的命名空间中为 oplog 存储部署MongoDB database资源。
注意
创建此数据库作为副本集。
将资源的
metadata.name与您在 Ops Manager 资源定义中指定的spec.backup.opLogStores.mongodbResourceRef.name进行匹配。选择以下选项之一:
在与MongoDB database 资源相同的命名空间中部署块存储的MongoDB Ops Manager 资源。
将资源的
metadata.name与您在 Ops Manager 资源定义中指定的spec.backup.blockStores.mongodbResourceRef.name进行匹配。配置 S3 存储桶以用作 S3快照存储。
确保您可以使用Ops Manager资源定义中指定的详细信息访问权限S3 存储桶。
可选:确认MongoDB Ops Manager资源正在运行。
如果已启用备份,请通过调用以下命令检查MongoDB Ops Manager资源的状态:
kubectl get om -o yaml -w
当MongoDB Ops Manager正在运行时,该命令会在 status字段下返回以下输出:
status: applicationDatabase: lastTransition: "2022-04-01T10:00:32Z" members: 3 phase: Running type: ReplicaSet version: "8.0.0-ubi8" backup: lastTransition: "2022-04-01T10:00:53Z" phase: Running version: "8.0.0-ubi8" opsManager: lastTransition: "2022-04-01T10:00:34Z" phase: Running replicas: 1 url: http://om-svc.cloudqa.svc.cluster.local:8080 version: "8.0.0"
有关资源部署状态的信息,请参阅排除 Kubernetes 操作符故障。