简体   繁体   English

如何将旧集群的公共 IP 地址分配给新集群

[英]How to assign public IP address from old cluster to new cluster

I just created a new AKS cluster that has to replace an old cluster.我刚刚创建了一个必须替换旧集群的新 AKS 集群。 The new cluster is now ready to replace the old one, except for one crucial thing, it's outbound ip address.新集群现在已经准备好替换旧集群了,除了一个关键的事情,它是出站 IP 地址。 The address of the old cluster must be used so that our existing DNS records do not have to change.必须使用旧集群的地址,这样我们现有的 DNS 记录就不必更改。

How do I change the public IP address of the Azure load balancer (that is used by the nginx ingress controller) of the new cluster to the one used by the old cluster?如何将新集群的 Azure 负载均衡器(由 nginx 入口控制器使用)的公共 IP 地址更改为旧集群使用的 IP 地址? The old cluster is still running, I want to switch it off / delete it when the new cluster is available.旧集群仍在运行,我想在新集群可用时将其关闭/删除。 Some down time needed to switch the ip address is acceptable.切换 IP 地址所需的一些停机时间是可以接受的。

I think that the ip first has to be deleted from the load balancer's Frontend IP configuration of the old cluster and can then be added to the Frontend IP configuration of the load balancer used in the new cluster.我认为首先必须从旧集群的负载均衡器的前端 IP 配置中删除 ip,然后才能将其添加到新集群中使用的负载均衡器的前端 IP 配置中。 But I need to know exactly how to do this and what else need to be done if needed (maybe adding a backend pool?)但我需要确切地知道如何做到这一点以及如果需要还需要做什么(也许添加一个后端池?)

Update更新

During the installation of the new cluster I already added the public ip address of the load balancer of the old cluster in the yaml of the new ingress-nginx-controller.在安装新集群的过程中,我已经在新的 ingress-nginx-controller 的 yaml 中添加了旧集群的负载均衡器的公共 IP 地址。 The nginx controller load balancer in the new cluster is in the state Pending and continuously generating events with message "Ensuring Load Balancer".新集群中的 nginx 控制器负载均衡器处于Pending状态,并不断生成带有消息“Ensuring Load Balancer”的事件。 Could it be that simple that I only need to assign an other ip address to the ingress-nginx-controller load balancer in the old cluster so that the ip can be used in the new cluster?难道就这么简单,我只需要给旧集群中的ingress-nginx-controller负载均衡器分配一个其他的ip地址,这样这个ip就可以在新集群中使用了吗?

You have to create a static public IP address for the AKS cluster.您必须为 AKS 群集创建一个静态公共 IP 地址。 Once you delete the old cluster, the public IP address and load balancer associated with it will be deleted as well.删除旧集群后,与之关联的公共 IP 地址和负载均衡器也将被删除。 You can check and try this documentation[1] for a detailed guide.您可以查看并尝试此文档 [1] 以获取详细指南。

[1] https://docs.microsoft.com/en-us/azure/aks/static-ip [1] https://docs.microsoft.com/en-us/azure/aks/static-ip

I managed to assign the old ip to the new cluster.我设法将旧 ip 分配给新集群。 These are the steps that I followed:这些是我遵循的步骤:

  1. Create a new static and public ip in the old cluster (nn.nn.nn.nn):在旧集群(nn.nn.nn.nn)中创建一个新的静态和公共 ip:

     az network public-ip create --resource-group MC_rg-my-old-cluster \ --name aks-public-ip-tmp --sku Standard --allocation-method static \ --query publicIp.ipAddress -o tsv
  2. Put the new ip in the load balancer service of the nginx controller:将新 ip 放入 nginx 控制器的负载均衡服务中:

     spec.ports.loadBalancerIP: nn.nn.nn.nn
  3. Move old ip address (oo.oo.oo.oo) to the resource group of the new cluster:将旧 ip 地址 (oo.oo.oo.oo) 移动到新集群的资源组:

    • Find the resource group of the old cluster and open it;找到旧集群的资源组,打开;
    • Click on the public ip address that you want to move;点击你要移动的公网IP;
    • In the menu on the top there is a 'Move' item, select "Move to another resource group"在顶部的菜单中有一个“移动”项,选择“移动到另一个资源组”
    • Select the resource group of the new cluster选择新集群的资源组
  4. After the ip is moved (can take a while) you can use it in the load balancer service of the nginx controller in the new cluster:移动 ip 后(可能需要一段时间),您可以在新集群中 nginx 控制器的负载均衡器服务中使用它:

     spec.ports.loadBalancerIP: oo.oo.oo.oo

I don't know if steps 1 and 2 are really needed.我不知道是否真的需要第 1 步和第 2 步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM