Microservice architectures involve a number of smaller microservices interacting with each other. Adding to this, there can be multiple instances of each microservice. Maintaining the external service connections and configurations manually would be difficult as new instances of microservices are dynamically created and destroyed. Name servers provide features of service registration and service discovery. Name servers allow microservices to register themselves and also discover the URLs to other microservices they want to interact with.
The Name server
Limitations of hard coding microservice URLs
In the previous example, we added the following configuration to application.properties in the service consumer microservice:
...