Service discovery for microservices - spring-boot

I need some help in understanding how we implement service discovery for microservices in kubernetes.
Im going through some tutorials on spring boot and noticed that wr need to use Eureka discovery for implementing service discovery for maintaining communication b/w microservices. But my question is if we deploy those spring boot microservices in kubernetes, do we still need to use Eureka tool? We can use kubernetes services for implementing service discovery and load balancing right?

Kubernetes orchestration platform provides CoreDNS for Service discovery. Micro services when they get deployed to the platform can utilise the services by default no need to implement it unless if there is specific requirements which is not satisfied . Kubernetes Loadbalancer services type can be used for load balancing of services

Related

Service Discovery within Kubernetes

When deploying a set of SpringBoot microservice applications in a Kubernetes cluster, should I include any kind of service discovery client libraries in my SpringBoot application to leverage kubernetes-native-service-discovery? If not, how a caller service calls another microservice in the same cluster?
Thanks in advance.
A service in kubernetes can be invoked as mentioned below for example an http service. An service has to be created and associated with pod. Please refer kubernetes services documentation for various services.
http://<service-name>:<port>
No other changes are required from application end. Please refer kubernetes official documentation for resolution details

Deployment of spring application on kubernetes cluster

I am going to create a kubernetes cluster to deploy all my spring boot microservices. Currently I have a spring cloud gateway server, a eureka discovery server and my back-end and front-end applications.
Do we need gateway server and discovery server if deployed on kubernetes, as these services are provided as part of cluster?
Thanks.
You are not required to use the Spring Cloud Gateway or Eureka discovery server. Kubernetes provides all basic building blocks (like Service) implemented without additional software requirements (for example with plain DNS).
If you need a more advanced setup you can integrate kubernetes API in Spring applications or use other ways to integrate. For the 90% case there is no need to do so.

Service discovery in kubernetes/ spring boot

What are the benefits to use "spring service discovery kubernetes" instead of using directly the Service DNS coming from Kubernetes?
I mean, If I deploy in kubernetes 2 services (service-a and service-b), and service-b exposes a Rest API.
service-a can easily connect to service-b using the url "http://service-b/...".
Question #1. In order to let service-a be able to connect to service-b using the service DNS, service-b has to be deployed before service-a?
Question #2. What are the pros/cons using the spring discovery?
Question #1:
No, the order in which you deploy the services is not important to use the kubernetes DNS services to resolve the ips, the only thing here is that if you deploy serviceA after serviceB, you will have in serviceA as an environment variable the ip of serviceB but not the inverse.
Question #2:
The spring service discovery is an alternative to the native kubernetes service discovery and it is used by other spring cloud projects like spring-cloud-eureka to perform the service discovery. The only pros I see in this approach is that you can custom the load balancing algorithm tath you can use to spread the load among the different instances

Using Netflix Eureka on Kubernetes

We are currently setting up a Micro-service Architecture using spring boot and netflix components, for Deployment we are planning to go with aws kubernetes(EKS) setup. We are in a in a dilemma to choose whether to use netflix's Eureka & ribbon services on Kubernetes for service discovery or to use Kubernetes own service discovery Mechanism. The advantages I see in using k8s service discovery is that horizontal scaling becomes easy. Any thoughts on this will be really good for us to take it in the right direction.
Thanks.
If you don't have a strong case for client side load balancing I would not use Eureka and ribbon. I am getting the load balancing and service discovery from my platform (k8s) for free. If not for client side load balancing, there is no value that eureka and ribbon brings other than beefing up your resume :). On the other hand, it brings another stack that you need to maintain in the long term.
This is a kind of related question

what is the difference between netflix zuul server and netflix eureka server?

i have created two java spring-boot micro services they are
1) producer
2) consumer
and i have used spring eureka server for service registration and discovery . it worked fine . then what is the use of Netflix Zuul.
Let's suppose you have 20 services to which user can interact to, and of course we are not going to expose each and every services publicly because that will be madness (because all services will have different ports and context), so the best approach will be to use an API gateway which will act as single entry point access to our application (developed in micro service pattern) and that is where Zuul comes into picture. Zuul act as a reverse proxy to all your micro-services running behind it and is capable of following
Authentication
Dynamic Routing
Service Migration
Load Shedding
Security
Static Response handling
Active/Active traffic management
You can go through documentation here
If you have enough experience in the domain, you could look at zuul as an API gateway like Apigee. It is very feature rich and touches up on a lot of different concerns like routing, monitoring and most importantly, security. And eureka as a service discovery platform that allows you to load balance (in Linux terms the nginx or haproxy) and fail over between your service instances.
Typically the backend services that perform the server side business operations (i.e. core) are not exposed publicly due to many reasons. They are shielded by some Gateway layer that also serves as reverse-proxy. Netflix Zuul serves as this gateway layer which easily gives you the capabilities as mentioned by #Apollo and here

Resources