Docs 菜单
Docs 主页
/
MongoDB Enterprise Kubernetes Operator
/

在受限网络中部署

本教程演示如何在受限网络MongoDB Enterprise MongoDB Ops ManagerMongoDBKubernetesOpenShift环境中使用 Operator 部署 Operator、 实例和 副本集。

1

Red Hat 操作符目录包含 OLM查询以在集群上安装操作符及其依赖项的元数据。您必须创建操作符目录的副本,然后以集群管理员身份禁用默认目录。

操作符包中的 relatedImages列出了以下映像:

  • 操作符直接使用的图像,即mongodb-enterprise-init-database-ubimongodb-enterprise-init-ops-manager-ubimongodb-enterprise-init-appdb-ubimongodb-enterprise-init-database-ubi的当前版本。

  • 可以在MongoDB Ops Manager部署中配置的MongoDB Ops Manager 、AppDB 和 mongodb-agent-ubi 当前支持的所有映像。

对于init映像,请仅使用最新 Kubernetes Operator 版本中存在的版本。

操作符包引用的所有相关映像的大小超过26 GB。

您的镜像命令不会选择不支持的 AppDB 映像版本。 如果要使用任何其他不受支持的版本,则必须手动向镜像注册表提供这些映像。 有关给定 Operator 版本的其他版本,请参阅部署的 映像。

RELATED_IMAGE_*有关 环境变量中定义的映像的完整列表,请参阅 CSV 文件。

  1. 要进行镜像,请参阅 为离线安装制作镜像。

    当您运行oc adm catalog mirror 命令来镜像目录时,它会生成 文件,您必须 应用imageContentSourcePolicy.yaml 该文件 将原始源重新映射到镜像。例如:

    oc apply -f ./<output dir>/imageContentSourcePolicy.yaml

    要了解更多信息,请参阅 用于断开连接的集群的 Mirroring Operator 目录 。MongoDB有关每个MongoDB Ops Manager 版本支持的 版本列表,请参阅 兼容的MongoDB 版本。

  2. 要禁用默认目录,请将disableAllDefaultSources: true添加到OperatorHub对象。

要了解更多信息,请参阅 在受限网络上使用 Operator Lifecycle Manager。

2

要了解详情,请参阅:

  • 规划 MongoDB Enterprise Kubernetes Operator 安装

  • 安装 MongoDB Enterprise Kubernetes Operator

3

要在本地模式下部署MongoDB Ops Manager ,必须执行以下操作:

  1. 复制以下示例MongoDB Ops ManagerKubernetes 对象 并将其另存为.yaml 文件。

    • 使用 中的 配置设置MongoDB Ops Managerautomation.versions.source: local spec.configuration来启用本地模式。

    • 定义 持久卷 用于 Ops Manager StatefulSet 存储 MongoDB 安装存档。在使用 Kubernetes Operator 创建的 MongoDB 数据库资源容器中运行的 MongoDB 助手会从 Ops Manager 而不是从 Internet 下载安装存档。

    1apiVersion: mongodb.com/v1
    2kind: MongoDBOpsManager
    3metadata:
    4 name: ops-manager-localmode
    5spec:
    6 replicas: 2
    7 version: "6.0.0"
    8 adminCredentials: ops-manager-admin-secret
    9 configuration:
    10 # this enables local mode in Ops Manager
    11 automation.versions.source: local
    12 statefulSet:
    13 spec:
    14 # the Persistent Volume Claim will be created for each Ops Manager Pod
    15 volumeClaimTemplates:
    16 - metadata:
    17 name: mongodb-versions
    18 spec:
    19 accessModes: [ "ReadWriteOnce" ]
    20 resources:
    21 requests:
    22 storage: "20Gi"
    23 template:
    24 spec:
    25 containers:
    26 - name: mongodb-ops-manager
    27 volumeMounts:
    28 - name: mongodb-versions
    29 # this is the directory in each Pod where all MongoDB
    30 # archives must be put
    31 mountPath: /mongodb-ops-manager/mongodb-releases
    32 backup:
    33 enabled: false
    34 applicationDatabase:
    35 members: 3
    36 persistent: true

    要了解有关设置的更多信息,请参阅部署 Ops Manager 资源。

  2. oc 配置为默认命名空间。

    oc config set-context $(oc config current-context) --namespace=<metadata.namespace>
  3. 复制以下MongoDB Ops Manager资源设置,粘贴到现有MongoDB Ops Manager资源中,然后保存MongoDB Ops Manager配置文件。

    1configuration:
    2 # this enables local mode in Ops Manager
    3 automation.versions.source: local
    4statefulSet:
    5 spec:
    6 # the Persistent Volume Claim will be created for each Ops Manager Pod
    7 volumeClaimTemplates:
    8 - metadata:
    9 name: mongodb-versions
    10 spec:
    11 accessModes: [ "ReadWriteOnce" ]
    12 resources:
    13 requests:
    14 storage: "20Gi"
    15 template:
    16 spec:
    17 containers:
    18 - name: mongodb-ops-manager
    19 volumeMounts:
    20 - name: mongodb-versions
    21 # this is the directory in each Pod where all MongoDB
    22 # archives must be put
    23 mountPath: /mongodb-ops-manager/mongodb-releases
  4. 将MongoDB安装存档复制到MongoDB Ops Manager持久卷。

    要了解如何复制MongoDB安装存档,请参阅配置MongoDB Ops Manager资源以使用本地模式过程中的步骤 10。

  5. 创建凭证并将其存储为密钥。

    运行以下命令:

    注意

    为以下参数提供公钥和私钥值。如需了解更多信息,请参阅“创建 Kubernetes Operator 的凭证”。

    oc \
    create secret generic ops-manager-admin-key \
    --from-literal="publicKey=<publicKey>" \
    --from-literal="privateKey=<privateKey>"
  6. 创建一个类似于以下内容的 ConfigMap:

    cat <<EOF | oc apply -f -
    apiVersion: v1
    kind: ConfigMap
    metadata:
    name: my-project
    namespace: mongodb
    data:
    projectName: myProjectName # this is an optional parameter
    orgId: 5b890e0feacf0b76ff3e7183 # this is a required parameter
    baseUrl: https://ops.example.com:8443
    EOF

    要了解有关 ConfigMap 中设置的更多信息,请参阅OpenShift 快速入门中的步骤7 。

要了解有关在本地模式下部署 Ops Manager 的更多信息,请参阅配置 Ops Manager 资源以使用本地模式。

4

您可以部署副本集部署分片集群。 要了解更多信息,请参阅部署MongoDB database资源。

后退

快速入门

来年

Kubernetes Operator 架构