AKS icon indicating copy to clipboard operation
AKS copied to clipboard

AKS keeps creating new public ip even if a static public ip is specified at spec.loadBalancerIp

Open yhvicey opened this issue 7 years ago • 4 comments

What happened: AKS keeps creating new public ip even if a static public ip is specified at spec.loadBalancerIp.

What you expected to happen: AKS should use the public ip I specified.

How to reproduce it (as minimally and precisely as possible):

  1. Create a new aks cluster
  2. Create a public static ip address in resource group created by AKS
  3. Deploy a service with spec.type=LoadBalancer and spec.loadBalancerIp=<ip address in last step>
  4. AKS will create a load balancer but it won't use the existing ip address but create a new one.

Environment:

  • Kubernetes version: 1.11.5
  • Size of cluster: 2 nodes (D8s v3)

yhvicey avatar Jan 16 '19 10:01 yhvicey

I looked into that a while ago and could not get it working either. I believe it is a limitation of the azure cloud provider in kubernetes

Looking at the code of 1.11, the spec.loadBalancerIp is being used for internal load balancers only.

https://github.com/kubernetes/kubernetes/blob/e1552d8ef9043604aae6b08b2742c9d4f3f281bc/pkg/cloudprovider/providers/azure/azure_loadbalancer.go#L678

mpluhar avatar Jan 16 '19 18:01 mpluhar

We haven't tested on 1.11, but on 1.10, it does work for us with spec.loadBalancerIP. The only difference I see is that IP is uppercase, instead of Ip. Not sure if that matters.

We also add the annotation service.beta.kubernetes.io/azure-load-balancer-resource-group to refer to an IP in another resource group.

saykumar avatar Jan 16 '19 21:01 saykumar

Cool, good to know.

mpluhar avatar Jan 16 '19 21:01 mpluhar

It's because i'm used Ip instead of IP. Using spec.loadBalancerIP solved the issue. Thx @saykumar !

yhvicey avatar Jan 17 '19 05:01 yhvicey