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

为 Kubernetes 操作符 创建档案

为了让Kubernetes Operator 在Cloud Manager或MongoDB Ops Manager项目中创建或更新对象,您需要将编程API密钥存储在密钥存储工具中。

同一个命名空间中可以存在多个密钥。 每个用户都应该有自己的密钥。

您可以按照以下 步骤 手动将 编程 API 密钥 存储为 Kubernetes 密钥 。或者,您可以:

要为 Kubernetes 操作符 创建档案,您必须:

  1. 拥有或创建MongoDB Ops Manager组织。

  2. 拥有或生成编程API密钥。

  3. 授予此新的编程 API 密钥:

    注意

    You must grant the Programmatic API Key the Organization Owner or Global Owner role. If you want to grant the Programmatic API Key only the Project Owner role, you must first create the project and then the Programmatic API Key for the project with the Project Owner role. The Kubernetes Operator can't create projects if the Programmatic API Key has only the Project Owner role.

  4. 将任何为Kubernetes Operator提供服务的主机的IPCIDR区块添加到API访问列表中。

要创建 Kubernetes 密钥,请执行以下操作:

1
  1. 确保您拥有所需 Ops Manager 编程 API 密钥的公钥和私钥。

  2. 调用以下 Kubernetes 命令来创建密钥:

    kubectl -n <metadata.namespace> \
    create secret generic <mycredentials> \
    --from-literal="publicKey=<publicKey>" \
    --from-literal="privateKey=<privateKey>"

    -n 标志限制了此密钥适用的命名空间。所有MongoDB Kubernetes资源必须与密钥ConfigMap位于同一命名空间中。Kubernetes Operator 不使用密钥或 ConfigMap。

    注意

    此命令的已弃用版本会指定userpublicApiKey ,而不是publicKeyprivateKey 。 Kubernetes 操作符接受任一版本的身份验证。

2

调用以下 Kubernetes 命令来验证您的密钥:

kubectl describe secrets/<mycredentials> -n <metadata.namespace>

此命令会在 Shell 中返回密钥描述:

Name: <mycredentials>
Namespace: <metadata.namespace>
Labels: <none>
Annotations: <none>
Type: Opaque
Data
====
privateKey: 31 bytes
publicKey: 22 bytes
给本页内容打分

在此页面上