How to assign public IP address from old cluster to new cluster

Patrick Koorevaar 6 Reputation points
2022-07-05T14:02:06.463+00:00

Hello,

I also asked this question on SO. But maybe here someone can give me advice.

I just created a new AKS cluster that has to replace an old cluster. The new cluster is now ready to replace the old one, except for one crucial thing, it's outbound ip address. The address of the old cluster must be used so that our existing DNS records do not have to change.

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? 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.

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. 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. The nginx controller load balancer in the new cluster is in the state Pending and continuously generating events with message "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?

Thanks in advance

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,146 questions
Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
451 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Patrick Koorevaar 6 Reputation points
    2022-07-06T00:38:42.57+00:00

    I managed to assign the old ip to the new cluster. These are the steps that I followed:

    1. Create a new static and public ip in the old cluster (nn.nn.nn.nn): 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: spec.ports.loadBalancerIP: nn.nn.nn.nn
    3. Move old ip address (oo.oo.oo.oo) to the resource group of the new cluster:
      • Find the resource group of the old cluster and open it;
      • Click on the public ip address that you want to move;
      • 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

    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:

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

    I don't know if steps 1 and 2 are really needed.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.