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

配置对 Atlas 的访问

要连接到Atlas Administration API, Atlas Kubernetes Operator会从Atlas Kubernetes Operator密钥中读取组织ID和API密钥。您还可以配置以下功能:

To learn more about creating an Atlas account, see Register and Log in to Atlas.

根据您的配置, Atlas Kubernetes Operator会读取以下Atlas Kubernetes Operator密钥之一:

范围
地点
说明

全局

在安装Atlas Kubernetes <operator-deployment-name>-api-keyOperator 的同一命名空间中创建的 Atlas Atlas Kubernetes Operator密钥 。

Atlas Kubernetes Operator 使用此密钥数据连接到 Atlas Administration API,除非AtlasProject自定义资源指定spec.connectionSecretRef.name 。

global Atlas Kubernetes Operator secrets let you use one API key for all the projects in an organization. Any new AtlasProject Custom Resource uses the same API key for reduced overhead.

Atlas Kubernetes Operator部署的默认名称是 mongodb-atlas-operator。因此,密钥 应命名为 mongodb-atlas-operator-api-key。

项目

在spec.connectionSecretRef.name 自定义资源中使用 引用的Atlas KubernetesAtlasProject Operator密钥。

默认下, Atlas Kubernetes Operator将连接密钥保存在与 AtlasProject自定义资源相同的命名空间中。要在其他命名空间中存储密钥,请指定spec.connectionSecretRef.namespace 参数。

Atlas Kubernetes Operator使用此密钥数据连接到引用该项目的任何AtlasDeployment 自定义资源和 AtlasDatabaseUser 自定义资源的Atlas API 。

如果您不指定spec.connectionSecretRef.name ,Atlas Kubernetes Operator 将使用global Atlas Kubernetes Operator 密钥。

每个项目的 Atlas Kubernetes Operator 密钥允许更细粒度的访问。您可能需要使用单个 API 密钥来访问单个 Atlas 项目。

global 和 project 密钥 都需要以下信息:

Parameter
说明

orgId

24string用于标识Atlas 组织 的唯一 位十六进制 。

publicAPIKey

Public part of the API key.

privateAPIKey

Private part of the API key.

您需要以下公共 API 密钥、私有 API 密钥和组织 ID 信息, 配置 Atlas Kubernetes Operator 对 Atlas 的访问权限。

如需配置 Atlas Kubernetes Operator 访问 Atlas,请执行以下步骤之一。

  • 对于 global Atlas Kubernetes Operator 密钥,运行以下命令:

    注意

    global Atlas Kubernetes Operator密钥的名称必须符合预定义的格式。Atlas Kubernetes Operator部署的默认名称是 mongodb-atlas-operator。因此,密钥 应命名为 mongodb-atlas-operator-api-key。

    kubectl create secret generic mongodb-atlas-operator-api-key \
    --from-literal="orgId=<the_atlas_organization_id>" \
    --from-literal="publicApiKey=<the_atlas_api_public_key>" \
    --from-literal="privateApiKey=<the_atlas_api_private_key>" \
    -n <operator_namespace>
    kubectl label secret mongodb-atlas-operator-api-key atlas.mongodb.com/type=credentials -n mongodb-atlas-system
  • 对于 project Atlas Kubernetes Operator 密钥,运行以下命令:

    kubectl create secret generic my-project-connection \
    --from-literal="orgId=<the_atlas_organization_id>" \
    --from-literal="publicApiKey=<the_atlas_api_public_key>" \
    --from-literal="privateApiKey=<the_atlas_api_private_key>" \
    -n <atlas_project_namespace>
    kubectl label secret mongodb-atlas-operator-api-key atlas.mongodb.com/type=credentials -n mongodb-atlas-system