如何在不中断正在运行的服务的情况下将 Azure 云上的资源从一个帐户迁移到另一个帐户?

如何在不中断正在运行的服务的情况下将 Azure 云上的资源从一个帐户迁移到另一个帐户?

我在 Azure Cloud 上已经有个人账户,账户下有 2 台虚拟机和一个 AKS 集群,我想将个人账户下的资源迁移到公司账户,如何做才符合最佳实践?如何确保虚拟机上运行的服务不中断?

答案1

不幸的是,Azure 中没有实时迁移功能。

  1. 首先,您需要在目标订阅中准备正确的资源。确保在目标订阅中创建必要的资源(VNET、存储帐户等),并与源订阅的配置相匹配。

  2. 使用 Azure CLI 或 Azure 门户导出源订阅中的 AKS 群集配置。 其中包括节点池、网络配置和服务主体等详细信息。

    az aks show --resource-group <source-resource-group> --name <aks-cluster-name> --subscription <source-subscription-id> --query "{name:name,location:location,resourceGroup:resourceGroup,kubernetesVersion:kubernetesVersion,dnsPrefix:dnsPrefix,servicePrincipalProfile:servicePrincipalProfile,agentPoolProfiles:agentPoolProfiles,networkProfile:networkProfile}" > aks-cluster-config.json

  3. 打开导出的配置文件 (aks-cluster-config.json) 并使用目标订阅的值更新相关字段,例如位置、资源组和其他特定于订阅的详细信息。

  4. 使用修改后的配置文件在目标订阅中创建AKS集群。

    az group create --name <target-resource-group> --location <target-location>

    az aks create --resource-group <target-resource-group> --name <aks-cluster-name> --subscription <target-subscription-id> --load-balancer-sku standard --enable-private-cluster --network-plugin azure --vnet-subnet-id <vnet-subnet-id> --service-cidr <service-cidr> --dns-service-ip <dns-service-ip> --docker-bridge-address <docker-bridge-address> --dns-prefix <dns-prefix> --enable-aad --aad-admin-group-object-ids <aad-admin-group-object-ids> --enable-managed-identity --node-resource-group <node-resource-group> --node-count <node-count> --node-vm-size <node-vm-size> --generate-ssh-keys

  5. 验证目标订阅中的 AKS 群集是否按预期运行。

相关内容