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

Kubernetes 操作符 Helm 安装设置

要提供可选设置,请使用--set参数将其传递给 Helm。 使用以下列出部署类型值设置的文件:

要了解可选的 Kubernetes Operator 安装设置,请参阅Operator Helm 安装设置。

按以下示例运行命令,指定的选项将传递到配置中:

helm upgrade mongodb-kubernetes-operator mongodb/mongodb-kubernetes \ --set registry.pullPolicy='IfNotPresent'

MongoDB 助手映像的名称。此设置将附加到注册表中。代理,并将 MDB_AGENT_IMAGE_REPOSITORY 环境变量设置为完整URL ,StatefulSet 从中下载用于数据库部署的MongoDB 助手映像。要学习;了解更多信息,请参阅规划Kubernetes Operator 容器映像。

默认值为 mongodb-agent 。

agent: name: mongodb-agent

应用程序数据库映像的名称。

默认值为 mongodb-kubernetes-appdb 。

appDb: name: mongodb-kubernetes-appdb version: 10.2.15.5958-1_4.2.11

包含应用程序数据库使用的 MongoDB Agent 的映像版本。

默认值为 10.2.15.5958-1_4.2.11。

appDb: name: mongodb-kubernetes-appdb version: 10.2.15.5958-1_4.2.11

MongoDB Enterprise 数据库映像的名称。

默认值为MongoDB Enterprise 数据库 。

database: name: mongodb-enterprise-database version: 1.15.0

Kubernetes 操作符部署的 MongoDB Enterprise 数据库映像的版本。

database: name: mongodb-enterprise-database version: 1.15.0

包含 MongoDB Agent 启动脚本和就绪探针的initContainer映像的名称。

默认值为 mongodb-kubernetes-init-database 。

database: name: mongodb-kubernetes-init-database version: 1.15.0

包含 MongoDB Agent 启动脚本和就绪探针的initContainer映像的版本。

默认值为 1.15.0 。

database: name: mongodb-kubernetes-init-database version: 1.15.0

包含 Ops Manager 启动脚本和就绪探针的initContainer映像版本。

默认值为 mongodb-kubernetes-init-ops-manager 。

database: name: mongodb-kubernetes-init-ops-manager version: 1.15.0

包含 Ops Manager 启动脚本和就绪探针的initContainer映像版本。

默认值为 1.15.0 。

database: name: mongodb-kubernetes-init-ops-manager version: 1.15.0

用于确定 Kubernetes 操作符 是否继承 Kubernetes 集群托管的securityContext设置的标志。

如果您想在 OpenShift 中或限制性环境中运行 Kubernetes 操作符,则该值必须为true 。

默认值为false 。

# Set this to true if your cluster is managing SecurityContext for you.# If running OpenShift (Cloud, Minishift, etc.), set this to true.managedSecurityContext: false

默认值为false ,它会自动更新图像后缀。

mongodb: appdbAssumeOldFormat: false

Kubernetes Operator 尝试连接到集群的Kubernetes API服务器端点的时间(以秒为单位)。此超时时间是为多 Kubernetes集群MongoDB部署中的所有Kubernetes集群设立的。如果Kubernetes Operator 在指定时间内没有从Kubernetes API服务器收到响应,则会将集群的状态记录为“unhealthy”(不健康)。要学习;了解更多信息,请参阅Kubernetes集群故障排除。

默认值为10 。

multiCluster: clusterClientTimeout: 10

要在其中部署Kubernetes Operator 的命名空间。

要使用默认值以外的命名空间,请指定要在其中部署 Kubernetes 操作符的命名空间。

默认值为mongodb 。

# Name of the Namespace to usenamespace: mongodb

Kubernetes Operator 部署环境的标签。 此值会影响默认超时以及日志记录级别和格式:

如果值为
日志级别设置为
日志格式设置为

dev

debug

text

prod

信息

JSON

默认值为prod 。

operator: # Execution environment for the operator, dev or prod. # Use dev for more verbose logging env: prod

Kubernetes Operator 可以执行的最大并发协调数。它会设置MaxConcurrentReconciles。要学习;了解更多信息,请参阅Kubernetes Operator 部署多个MongoDB副本集。

例子

operator: # Control how many reconciles can be performed in parallel. # Increasing the number of concurrent reconciliations decreases the time needed to reconcile all watched resources, # but it might result in request load spikes and increased load on the Ops Manager API, and the Kubernetes API server generally. maxConcurrentReconciles: 10

确定所有部署使用的容器架构:

默认为 non-static。

要启用静态容器,请设置为static 。

注意

此设置适用于所有部署,包括现有部署。要为单个部署启用静态容器,请改用 metadata.annotations.mongodb.com/v1.architecture MongoDB 资源中的。

operator: mdbDefaultArchitecture: static

确定使用静态容器(公共预览版)的所有部署和应用程序数据库的 mongodb-enterprise-server 映像的默认变体。在Kubernetes Operator 上设置 MDB_DEFAULT_IMAGE_TYPE。

接受的值为:

  • ubi8

  • ubi9

  • ubi9-slim

未设置时,使用静态容器的部署使用 ubi9,非静态应用程序数据库使用 ubi8。

operator: mdbDefaultImageType: ubi9-slim

Kubernetes 分配给 Kubernetes 操作符对象的名称,例如 Deployments、ServiceAccounts、角色 和 Pod。

此值还对应于 Kubernetes Operator 所在容器注册表的名称。

默认值为 mongodb-kubernetes-operator 。

operator: name: mongodb-kubernetes-operator

设置Kubernetes 操作符 Pod 的安全上下文。您可以在Kubernetes文档中学习;了解有关 Pod 安全上下文的更多信息。

operator: podSecurityContext: runAsUser: 2000 runAsNonRoot: true

注意

如果将 managedSecurityContext设立为 true,则不使用 operator.podSecurityContext。

设置Kubernetes Operator容器的安全上下文。您可以在 Kubernetes 文档中了解有关容器安全上下文的更多信息。

operator: securityContext: {} # Defaults to empty object

注意

如果将 managedSecurityContext设立为 true,则不使用 operator.securityContext。

使Kubernetes Operator 能够收集和发送遥测数据。以下设置的默认值为 true。

operator: telemetry: # Enables telemetry. Setting this to "false" will stop all telemetry. enabled: true # Adds RBAC clusterRole for kube-system UID detection for the Kubernetes cluster UID. # Adds RBAC clusterRole for RBAC for nodes. We are listing exactly one node to detect the cluster provider (for example, eks). # Adds RBAC clusterRole for /version query for detecting Kubernetes server version. installClusterRole: true collection: # Controls how often the Kubernetes Operator collects and saves the data to the telemetry ConfigMap. It doesn't control whether this data is sent to MongoDB for analysis. # Valid time units for frequency are "m", or "h". Anything less than one minute defaults to 1h. frequency: 1h # Enables the Kubernetes Operator to collect and send cluster-level telemetry. # Note: the cluster UUID is unique but random and MongoDB has no way to map this to a customer. clusters: enabled: true # Enables the Kubernetes Operator to collect and send deployment-level telemetry. deployments: enabled: true # Enables the Kubernetes Operator to collect and send Kubernetes Operator-level telemetry. operators: enabled: true # Enables sending the collected telemetry to MongoDB. send: enabled: true # Controls how often the Kubernetes Operator sends the collected the data to MongoDB for analysis. # Valid time units are "h". Anything less than one hour defaults to 168h, which is one week. frequency: 168h

确定Kubernetes Operator 是否将密钥存储在HashiCorp Vault中。要学习;了解更多信息,请参阅设置密钥存储工具。如果将 TLS 与 Vault 结合使用,则还必须指定 操作符.vaultSecretBackend.tlsSecretRef。

默认值为false 。

operator: # Set the following setting to "true" so that the MongoDB Kubernetes Operator stores secrets in Vault. vaultSecretBackend: false

如果您将 TLS 与 Vault 一起使用,则必须进行此操作。在 Vault 配置中使用的包含 ca.crt 条目的 TLS 秘密。ca.crt条目的内容必须与用于生成 Vault TLS 证书的CA证书匹配。Kubernetes 操作符将此 TLS 秘密存储到其秘密存储工具中。要了解更多信息,请参阅配置密钥存储。要求 操作符.vaultSecretBackend.enabled 设置为 true。

operator: vaultSecretBackend: true tlsSecretRef: "vault-tls-secret"

要部署的 Kubernetes Operator 版本。

默认值为 1.15.0 。

operator: version: 1.15.0

Kubernetes Operator 监视 MongoDB资源更改的命名空间。如果此命名空间与默认空间不同,请确保Kubernetes Operator ServiceAccount 可以访问权限此命名空间。

  • 要监视所有命名空间,请指定*并将ClusterRole分配给用于运行Kubernetes Operator 的mongodb-kubernetes-operator ServiceAccount。

  • 要监视所有命名空间的子集,请在逗号分隔的列表中指定它们,使用反斜杠转义每个逗号,并用引号将该列表括起来,例如"operator.watchNamespace=ns1\,ns2" 。

在单个 Kubernetes 操作符实例监视不同集群资源类型的部署中,监视命名空间子集非常有用。例如,您可以将 Kubernetes 操作符 配置为监视一个命名空间子集中的MongoDB资源,并监视另一命名空间子集中的MongoDBMultiCluster资源。为了避免在资源协调期间出现竞争条件,对于您希望 Kubernetes 操作符监视的每种自定义资源类型,请确保将范围设置为命名空间的不同子集。

重要

要将MongoDB Ops Manager和 MongoDB 资源部署到部署Kubernetes Operator 以外的一个或多个命名空间,请参阅为Kubernetes Operator 部署的MongoDB控制器设置范围,了解必须使用的值以及可能需要执行的其他步骤。

默认值为<metadata.namespace> 。

# Watch one namespacehelm install mongodb-kubernetes-operator mongodb/mongodb-kubernetes \ --set operator.watchNamespace='namespace-to-watch' <...>
# Watch both namespace-a and namespace-bhelm install mongodb-kubernetes-operator mongodb/mongodb-kubernetes \ --set operator.watchNamespace="namespace-a\,namespace-b"
# Operator with name `mongodb-kubernetes-operator-qa-envs` will# watch ns-dev, ns-qa and ns-uat namespaces helm install mongodb-kubernetes-operator-qa-envs mongodb/mongodb-kubernetes \ --set operator.watchNamespace="ns-dev\,ns-qa\,ns-uat"
# Operator with name `mongodb-kubernetes-operator-staging` will# watch ns-staging and ns-pre-prodhelm install mongodb-kubernetes-operator-staging mongodb/mongodb-kubernetes --set operator.watchNamespace="ns-staging\,ns-pre-prod"

Kubernetes Operator 监视的自定义资源。

Kubernetes Operator 会为其安装CustomResourceDefinitions,并仅监控您指定的资源。

Kubernetes Operator 接受以下值:

值
说明

mongodb

安装数据库资源的 CustomResourceDefinitions 并监视这些资源。

mongodbusers

为 MongoDB 用户资源安装 CustomResourceDefinitions 并监视这些资源。

opsmanagers

安装 Ops Manager 的 CustomResourceDefinitions 并监视这些资源。

operator: watchedResources: - mongodbusers - mongodb - opsmanagers

Ops Manager 映像的名称。

默认值为MongoDB Enterprise-ops-经理 。

opsManager: name: mongodb-enterprise-ops-manager

MongoDB映像的 Quay容器注册表的URL 。附加代理.name 并将 MDB_AGENT_IMAGE_REPOSITORY 环境变量设置为完整URL ,StatefulSet 从该完整 URL 下载用于数据库部署的MongoDB 助手映像。要学习;了解更多信息,请参阅规划Kubernetes Operator 容器映像。

默认值为quay.io/mongodb 。

registry: agent: quay.io/mongodb/

Kubernetes 操作符从存储库下载应用程序数据库映像的URL。

默认值为quay.io/mongodb 。

registry: appDb: quay.io/mongodb

密钥,其中包含从存储库中提取映像所需的凭证。

重要

OpenShift 需要此设置。 在此文件的imagePullSecrets设置中定义,或在使用 Helm 安装 Kubernetes 操作符时传递。如果您使用 Kubernetes Operator 将 MongoDB 资源部署到多个命名空间或在集群范围内部署 MongoDB 资源,请仅在安装 Kubernetes Operator 的命名空间中创建密钥。Kubernetes 操作符在所有受监视的命名空间之间同步密钥。

registry:# Specify the secret in the ``imagePullSecrets`` setting. If you# use the MongoDB Kubernetes Operator to deploy MongoDB resources# into multiple namespaces, create the secret only in the namespace# where you installed the Operator. The Operator synchronizes# the secret across all watched namespaces. imagePullSecrets: <openshift-pull-secret>

URL 的存储库,从该存储库下载包含 Ops Manager 启动脚本和就绪探针的 initContainer 图像。

默认值为quay.io/mongodb 。

registry: initOpsManager: quay.io/mongodb

从中拉取 Kubernetes Operator 映像的存储库。 如果要从私有存储库拉取 Kubernetes 操作符 映像,请指定此值。

默认值为quay.io/mongodb 。

registry: operator: quay.io/mongodb

URL 的存储库,从该存储库下载Ops Manager 资源的映像。

默认值为quay.io/mongodb 。

registry: opsManager: quay.io/mongodb

Kubernetes Operator 的CPU 和内存消耗限制规范。

例子

operator: # operator requests resources: requests: cpu: 500m memory: 200Mi limits: cpu: 1100m memory: 1Gi

Kubernetes Operator 的CPU 和内存消耗限制规范。

例子

operator: # operator limits resources: limits: cpu: 1100m memory: 1Gi

标志允许您为Kubernetes集群角色配置用户验证准入 Webhook。

如果您的部署不允许Kubernetes集群角色,请将此标志设置为false 。

默认值为true 。

operator: webhook: installClusterRole: false
给本页内容打分