how to change external ip (specifically) of kubernetes service?

trust 1 Reputation point
2021-12-20T06:05:07.087+00:00

I updated the cluster a few days ago.
I deleted the service and rebuilt it.
As a result, the external ip was changed.
Is there a way to set it up with the previous IP?

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,458 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Praveen Prabhakaran 546 Reputation points Microsoft Employee
    2021-12-20T06:19:14.53+00:00

    @trust

    assuming that your external IP is public IP. if the IP was reserved earlier and still available in your subscription still you can reuse the IP with below.

    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

    if the previous IP was dynamic it is not possible to get the IP back. you can follow below article to reserve the IP and use static IP going further.

    https://learn.microsoft.com/en-us/azure/aks/static-ip

    0 comments No comments

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.