azurekubernetes-ingressazure-aksambassador

How to set static public ip for ambassador service in aks?


Got following problem:
- My setup is aks in azure. Inside got few services and ambassador working in front of them.
- I know how to setup public static ip for "regular" load balancer (https://learn.microsoft.com/en-us/azure/aks/static-ip)
- When im trying to do the same in my ambassador yaml:

apiVersion: v1
kind: Service
(..)
spec:
  type: LoadBalancer
  loadBalancerIP: XX.XXX.XX.XXX // <= line from microsoft documentation
  ports:
  - name: ambassador
    port: 80
    targetPort: 8080
  - name: ambassador-secure
    port: 443
    targetPort: 443
  selector:
    service: my-selector

the static ip ive passed seems to be ignored and each time new one is being created. Any ideas what im doing wrong? Thanks in advance.


Solution

  • The resource group location seems to be the root cause here. If you have not put your public IP in the MC_xxxx resource group that AKS creates, the Kubernetes’ controller-manager won’t be able to find it since it is the default resource group that it looks under. Unless one is specified in your service manifest using the right service annotation.

    service.beta.kubernetes.io/azure-load-balancer-resource-group: myResourceGroup

    apiVersion: v1
    kind: Service
    metadata:
      annotations:
        service.beta.kubernetes.io/azure-load-balancer-resource-group: myResourceGroup
      name: azure-load-balancer
    spec:
      loadBalancerIP: 40.121.183.52
      type: LoadBalancer
      ports:
      - port: 80
      selector:
        app: azure-load-balancer