您可以访问 GitHub 上的 Atlas Kubernetes Operator 项目:
Atlas 帐户
Before you deploy Atlas Kubernetes Operator, you must create an Atlas account. To learn more, see Register and Log in to Atlas.
API 密钥
您需要以下公共 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 的访问权限。
服务账户
作为 API 密钥的替代方案,您可以使用服务账户进行基于令牌的身份验证。要了解更多信息,请参阅使用服务账户配置对 Atlas 的访问权限。
namespaces
您可以部署Atlas Kubernetes Operator来监控Kubernetes集群中的所有命名空间,或仅监控其命名空间。
Amazon Web Services 安全群组
You must configure VPC peering for your project before you can add an AWS security group to an access list. You can't set AWS security groups as temporary access list entries.
已弃用的配置参数
以下参数在 Atlas API中已弃用,Atlas Kubernetes Operator 不支持这些参数:
replicationSpecreplicationFactor
集群创建
创建免费集群只需不到 15 秒。
创建 Flex集群或专用集群最多可能需要 10 分钟。
连接字符串(Connection Strings)
您不能直接使用连接URL 。Atlas集群需要身份验证。您必须创建至少一个AtlasDatabaseUser 自定义资源,Kubernetes集群中的应用程序才能连接到Atlas 集群。Atlas Kubernetes Operator为项目中的每个集群和数据库用户组合创建一个特殊密钥。Kubernetes集群中的应用程序可以使用此密钥连接到Atlas 集群。AtlasDatabaseUser 自定义资源中的 spec.scopes 参数限制创建数据库用户的集群。
连接信息
要连接到 Atlas Administration API,Atlas Kubernetes Operator 从以下位置之一读取组织 ID 和凭证 (API密钥或服务帐户):
spec.connectionSecretRef.name(如果在
AtlasProject自定义资源 中指定)。默认下, Atlas Kubernetes Operator将连接密钥保存在与
AtlasProject自定义资源相同的命名空间中。要将密钥存储在其他命名空间中,请指定spec.connectionSecretRef。命名空间参数。globalAtlas Kubernetes Operator密钥<operator-deployment-name>-api-key(如果未指定 spec.connectionSecretRef.name)。
为了在 Atlas 中创建或更新资源,Atlas Kubernetes Operator 使用连接信息对 Atlas 进行API调用。
注意
Sometimes Atlas Kubernetes Operator makes multiple API calls in Atlas during the reconciliation of a custom resource. For example, AtlasProject has an IP Access List configuration for calling the matching API.
如果在协调过程中出现任何错误, status.conditions会进行更新以反映错误。
例子
- lastTransitionTime: "2021-03-15T14:26:44Z" message: 'POST https://cloud.mongodb.com/api/atlas/v1.0/groups/604a47de73cd8cag77239021/accessList: 400 (request "INVALID_IP_ADDRESS_OR_CIDR_NOTATION") The address 192.0.2.1dfdfd5 must be in valid IP address or CIDR notation.' reason: ProjectIPAccessListNotCreatedInAtlas status: "False" type: IPAccessListReady
支持的部署标志
当您部署. Atlas Kubernetes Operator 使用kubectl ,您可以添加以下标志来自定义配置:
标记 | 说明 | 默认值 |
|---|---|---|
| Atlas URL 域名,以斜线结尾。 |
|
| 指标端点绑定的地址。 |
|
| 探针端点绑定的地址。 |
|
| 包含 Atlas 凭证(API 密钥或服务账户)的秘密名称。如果您的 |
|
| 指示是否为控制器经理启用领导者选举的标志。领导者选举可确保一次只有一个控制经理处于活动状态。 |
|
| 日志条目的重要性或紧急程度。 您可以指定以下级别之一:
|
|
| 日志记录的格式。 您可以指定以下格式之一:
|
|
例子
以下命令设置 Atlas Kubernetes Operator 1.8.2 部署,在端口:8084上使用指标端点,日志级别为error :
kubectl apply --metrics-bind-address :8084 \ --log-level error \ -f https://raw.githubusercontent.com/mongodb/mongodb-atlas-kubernetes/1.8.2/deploy/all-in-one.yaml