ewramner
ewramner

Reputation: 6233

Azure Kubernetes (AKS) does not release public IPs

We are using managed Kubernetes in Azure (AKS) and have run out of public IP addresses. We only need one, but AKS creates a new public IP every time we deploy a service and it does not delete it when the service is deleted. For example:

apiVersion: v1
kind: Service
metadata:
  name: somename
spec:
  ports:
  - port: 443
    targetPort: 443
  selector:
    app: somename
  # Also tried this to reuse public IP in AKS MC resource group
  # https://learn.microsoft.com/en-my/azure/aks/static-ip
  # loadBalancerIP: x.x.x.x
  type: LoadBalancer

Every time this is deployed (kubectl create -f svc.yml) a new public IP is created. When it is deleted (kubectl delete -f svc.yml) the IP remains. Trying to reuse one of the existing IPs with loadBalanceIP as in the comments above fails, "Public ip address ... is referenced by multiple ipconfigs in resource ...".

We have created a service request but it takes ages, so I'm hoping this will be faster. I don't dare to just delete the public IPs in the AKS managed resource as that may cause issues down the line.

Is there a way to safely release or reuse the public IPs? We are using Kubernetes version 1.7.12. We have deleted the deployment referenced by the service as well, it makes no difference.

Upvotes: 4

Views: 2408

Answers (1)

4c74356b41
4c74356b41

Reputation: 72171

It should delete the IPs after some time (like 5 minutes tops). So the issue you are having is a bug. You can check k8s events to find the error and look at it.

Also, its perfectly safe to delete Azure resources. k8s wont freak out if they are gone.

Tested with k8s 1.9.1

Upvotes: 1

Related Questions