1
votes

I have an Azure Kubernetes Service cluster, running version 1.15.7. This cluster recently replaced an older cluster version (1.12.something). In the past, once the various service pods were up and running, we would create a public IP resource in Azure portal and assign it a name, then create a Service resource like this:

apiVersion: v1
kind: Service
metadata:
  name: myservice-frontend
  labels:
    app: myservice
spec:
  ports:
  - port: 80
    name: myservice-frontend
    targetPort: 80
  - port: 443
    name: myservice-frontend-ssl
    targetPort: 443
  selector:
    app: myservice-frontend
  type: LoadBalancer
  loadBalancerIP: 1.2.3.4

Finally, we'd add the public IP to a Traffic Manager instance.

Since upgrading to 1.15, this doesn't seem to work anymore. We can go through all the above steps, but as soon as the Service/Load Balancer is created, the public IP loses its DNS name, which causes it to be evicted from Traffic Manager. We can reset the name, but within 36-48 hours it gets lost again. My suspicion is that AKS is trying to apply a name to the associated IP address, but since I haven't defined one above, it just sets it to null.

How can I tell AKS what name to assign to a public IP? Better yet, can I skip the static public IP and let AKS provision a dynamic address and simply add the DNS name to Traffic Manager?

1

1 Answers

1
votes

This is indeed a bug in AKS 1.15.7

Azure - PIP dns label will be default deleted

The upshot is, this is part of a new feature in 1.15 that allows the DNS label for a LoadBalancer IP to be set in the Service configuration. So, the definition above can become:

apiVersion: v1
kind: Service
metadata:
  name: myservice-frontend
  labels:
    app: myservice
  annotations:
    service.beta.kubernetes.io/azure-dns-label-name: myservice-frontend
spec:
  ports:
  - port: 80
    name: myservice-frontend
    targetPort: 80
  - port: 443
    name: myservice-frontend-ssl
    targetPort: 443
  selector:
    app: myservice-frontend
  type: LoadBalancer

And the service will be automatically assigned a new static IP with the annotated DNS name.