Docs 菜单
Docs 主页
/ /
Atlas Kubernetes Operator

将 Flex集群迁移到专用集群

Atlas Kubernetes Operator支持从 Flex集群就地迁移到 Dedicated集群。这使您能够直接在Kubernetes环境中扩展数据库基础架构。

在开始之前,您必须具备以下条件:

  • 由Atlas Kubernetes Operator托管的现有 Flex 集群层 AtlasDeployment

  • 修改Kubernetes集群中 Flex 集群层 AtlasDeployment资源的权限。

  • 为您的Atlas项目启用计费功能。升级将导致向您的Atlas账户收取费用。

1

您可以在Atlas Kubernetes Operator托管的AtlasDeployment资源中找到您的 Flex集群配置。

以下示例显示了 us-east-1地区中Amazon Web Services上的 Flex集群配置。

# my-cluster.yaml
apiVersion: atlas.mongodb.com/v1
kind: AtlasDeployment
metadata:
name: my-flex-cluster
spec:
projectRef:
name: my-atlas-project
flexSpec:
name: my-cluster
providerSettings:
backingProviderName: AWS
regionName: US_EAST_1
2

spec.upgradeToDedicated字段添加到 AtlasDeployment资源中。此字段是一个布尔标志,当设立为 true 时,将启动从 Flex集群到专用集群的就地升级。

spec.deploymentSpec区块中,提供目标专用集群的完整配置。其中包括提供商、 地区、实例大小和任何其他必要参数等详细信息。

为专用集群使用与原始 Flex集群相同的名称。

注意

如果您为专用集群使用不同的名称,迁移将失败。

以下示例展示了如何修改 Flex集群配置以启动到专用集群的迁移。

# my-cluster.yaml
apiVersion: atlas.mongodb.com/v1
kind: AtlasDeployment
metadata:
# The name MUST remain the same
name: my-flex-cluster
spec:
projectRef:
name: my-atlas-project
# Add the upgrade flag
upgradeToDedicated: true
# Add the full configuration for the target Dedicated-cluster
deploymentSpec:
name: "my-cluster" # The name MUST remain the same
clusterType: REPLICASET
backupEnabled: true
replicationSpecs:
- regionConfigs:
- providerName: AWS
regionName: US_EAST_1
priority: 7
electableSpecs:
instanceSize: M10
nodeCount: 3
3

使用 kubectl apply 命令将更改应用到Kubernetes集群。

kubectl apply -f my-cluster.yaml
4

Atlas Kubernetes Operator会立即启动迁移进程。您可以使用 kubectl describe 命令监控进度。

kubectl describe atlasdeployment my-flex-cluster

最初,DeploymentReady 条件显示如下:

Status:
Conditions:
...
- Last Transition Time: 2025-06-18T10:00:00Z
Message: Cluster upgrade to dedicated instance initiated in Atlas...
Reason: FlexToDedicatedMigrationProgressing
Status: "False"
Type: DeploymentReady

迁移完成后,DeploymentReady 条件将更新为:

Status:
Conditions:
...
- Last Transition Time: 2025-06-18T10:15:00Z
Message: Cluster upgrade successful. You can now remove the 'upgradeToDedicated' flag from the spec.
Status: "True"
Type: DeploymentReady

升级完成后,您还会在输出中看到一个 Normal事件。如果迁移失败,DeploymentReady 条件会显示错误消息,Reason 条件则会显示错误消息。如果您已将集群迁移到 专用集群,则不会有任何变化。

5

迁移完成后,您可以从 AtlasDeployment资源中删除upgradeToDedicated 标志,然后再次应用。此步骤是可选步骤,但建议执行此步骤,以保持配置简洁并防止意外重新触发迁移。

最终的 AtlasDeployment资源如以下示例所示:

# my-cluster.yaml
apiVersion: atlas.mongodb.com/v1
kind: AtlasDeployment
metadata:
name: my-flex-cluster
spec:
projectRef:
name: my-atlas-project
deploymentSpec:
name: "my-cluster" # The name MUST remain the same
clusterType: REPLICASET
backupEnabled: true
replicationSpecs:
- regionConfigs:
- providerName: AWS
regionName: US_EAST_1
priority: 7
electableSpecs:
instanceSize: M10
nodeCount: 3
6

您已成功将 Flex集群迁移到专用集群。您的集群现在是专用集群M10实例。使用Atlas Kubernetes Operator将其作为专用集群进行管理。您的应用程序连接字符串现在点新的专用集群。

后退

AtlasFederatedAuth

在此页面上