要连接到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密钥之一:
范围 | 地点 | 说明 |
|---|---|---|
全局 | 在安装Atlas Kubernetes | Atlas Kubernetes Operator 使用此密钥数据连接到 Atlas Administration API,除非
Atlas Kubernetes Operator部署的默认名称是 |
项目 | 在 默认下, Atlas Kubernetes Operator将连接密钥保存在与 | Atlas Kubernetes Operator使用此密钥数据连接到引用该项目的任何 如果您不指定 每个项目的 Atlas Kubernetes Operator 密钥允许更细粒度的访问。您可能需要使用单个 API 密钥来访问单个 Atlas 项目。 |
参数
global 和 project 密钥 都需要以下信息:
Parameter | 说明 |
|---|---|
| 24string用于标识Atlas 组织 的唯一 位十六进制 。 |
| Public part of the API key. |
| Private part of the API key. |
先决条件
您需要以下公共 API 密钥、私有 API 密钥和组织 ID 信息, 配置 Atlas Kubernetes Operator 对 Atlas 的访问权限。
If you want Atlas Kubernetes Operator to create a new Atlas project, Grant Programmatic Access to an Organization. If your organization requires an IP access list for the Atlas Administration API, you must also configure the API access list.
重要
您必须为 API 密钥分配 Organization Project Creator 或更高级别的组织角色。
If you want to work with an existing Atlas project, Add Project Access from a Project. If your organization requires an IP access list for the Atlas Administration API, you must also configure the API access list.
重要
您必须为 API 密钥分配 Project Owner 项目角色。
步骤
如需配置 Atlas Kubernetes Operator 访问 Atlas,请执行以下步骤之一。
对于
globalAtlas Kubernetes Operator 密钥,运行以下命令:注意
globalAtlas 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 对于
projectAtlas 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