AKS Spring MicroServices fails to resolve pod names

Brijesh 0 Reputation points
2025-01-08T20:35:08.71+00:00

I am trying to move a hosted application that is using docker and spring boot to AKS. we have 13 to 15 microservices that need to be run and each microservice registers itself to the Eureka server with their hostname ( pod name ) . when the other microservices tries to resolve for the pod names it is failing. how should I handle this case.

I tried adding it to hosts file but it will not work as services are interdepend and the pod name changes when pods restart.

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,225 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mounika Reddy Anumandla 1,550 Reputation points Microsoft Vendor
    2025-01-09T07:13:24.81+00:00

    Hi Brijesh,

    As per my understanding, to handle service discovery in your AKS deployment with Spring Boot and Eureka, you should leverage Kubernetes services instead of relying on pod names. Each microservice can be exposed as a service, which provides a stable DNS name that other services can use to communicate. When services register with Eureka, they should be configured to use a specific service endpoint rather than the dynamic pod name. And also, ensure that all microservices can access the Eureka server and properly register themselves with the service names rather than pod names.

    References: https://zcusa.951200.xyz/en-us/azure/spring-apps/basic-standard/how-to-service-registration?pivots=programming-language-java

    Similar scenario: https://stackoverflow.com/questions/62324729/spring-boot-microservices-are-getting-registered-to-eureka-with-the-pod-name-as

    Let me know if you have further queries!

    If the comment is helpful, please click "upvote".

    Thank you!

    1 person found this answer helpful.

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.