Deploying micro services to Pivotal Cloud Foundry and establish communication between the micro services - microservices

I have multiple .Net core micro services where some of the micro services will talk/communicate with the other micro services. I want to deploy these services to Pivotal Cloud Foundry(PCF) each to a different container and need to establish the communication between them.
I have tried using Registry service in PCF which didn't work out.
I wanted to know the steps which are used to establish the communication between the micro services.
Any existing example with code would help out.
Could anybody help on this?
Thanks

What you need is Steeltoe.
Steeltoe client libraries enable .NET Core and .NET Framework apps to easily leverage Netflix Eureka, Hystrix, Spring Cloud Config Server, and Cloud Foundry services.

Related

Service discovery for microservices

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

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.

How we configure API gateway, service discovery for micro services in pcf?

I am learning building microservices using spring boot, Spring Cloud(netflix OSS Components). I have used netflix Eureka for service discovery, zuul for api gateway, ribbon, feign while running in my local machine.
Netflix eureka, zuul, ribbon, feign spring cloud config are not useful when we deploy to PCF?(if yes what are the alternatives available in pcf and how to configure them?)
As who are building microservices follows CI/CD approach, how developer verify working of their micro services before pushing code as we don't use eureka, zuul,ribbon,feign in production pcf. (how to simulate pcf environment in developer machine?).
I'd suggest to read below content before implementing if you have any doubt regarding usage of Eureka and Zuul, you will get all answers yourself.
https://github.com/Netflix/eureka/wiki/Eureka-at-a-glance
https://github.com/Netflix/zuul/wiki
As who are building microservices follows CI/CD approach, how developer verify working of their micro services before pushing code as we don't use eureka, zuul,ribbon,feign in production pcf.
Answer to this question is: You must be aware of JUnit test cases, so you can run you test cases using deployment pipelines to make sure all your functionalities are working as expected or you can use Test Automation for the same.
(how to simulate pcf environment in developer machine?).
Answer to this one:
You can use eclipse plugin you are using eclipse/STS IDE. Or you can connect all PCF services from you local machine using CloudFactory
#Bean
public Cloud cloud() {
return new CloudFactory().getCloud();
}
https://docs.pivotal.io/pivotalcf/2-1/buildpacks/java/sts.html
Here are some thoughts:
Eureka Service discovery: in my opinion this is not strictly necessary when running on PCF. When you push an app on PCF usually a route is assigned to your app, and you can use this Route as a poor man's service discovery. Eureka would allow you to use client-side load balancing in the case of container-to-container networking, but usually you wouldn't need this.
Zuul: Can be very useful also on CloudFoundry in case you are doing things like writing frontend-for-backend services, providing frontends for different devices (mobiles, desktops, i-pads) that use the same backend services. Might also be useful for an authentication/authorization layer or rate-limiting. One native CloudFoundry alternative would be to use route-services for tasks such as rate limiting, authentication/authorization.
spring-cloud-config: makes sense if you want your configuration to be under version control for different environments. This is useful no matter if you are running on CloudFoundry or not. I don't know of any alternatives on plain CloudFoundry.
spring-cloud-feign: makes sense if you want use annotations such as #RequestMapping with your Feign client interfaces. This is independent on if you are running on CloudFoundry or not. AFAIK there are no alternatives for this in case you want to use Spring MVC annotations with Feign.
ribbon: makes sense if you want to use client side load balancing as opposed to let the CloudFoundry router to do the load balancing for you.
How developers can check locally if this works for them:
In general, I don't believe developers should need to check locally if their app is working fine together with zuul, cloud-config-service, and eureka.
They could check this in a dev or test space or environment though.
If they really want to check this on their local machine, they could download PCFDev and run these infrastructure components there.
Hope this helps.

Creating a Spring Cloud microservice

I am trying to learn and create a microservice using Spring Cloud. I am using Spring mvc and Spring Boot for development. I added separate Spring Boot application for both Eureka server and Zuul client. I have three Spring Boot application now. One Sureka server, one for Zuul routing and third one is for my microservice application. I run the Eureka server and the microservice and Zuul found to be running properly in Eureka server UI.
My doubt is that, I am planned to use routing and service discovery in my microservice. So I have a total of three Spring Boot applications. Can I deploy these three applications into AWS Elastic Beanstalk?
When I exploring I found that Pivotal Cloud Foundry topic. Since I am planing to use AWS Elastic Beanstalk. So what is the role of Pivotal Cloud Foundry in my application?
I am still confused about microservice development using Spring Cloud.
So there are two elements in your confusion. Is Amazon Beanstalk suitable?
So answer is yes. but you have overhead of orchestrating various services of amazon over then. Basically Amazon Elastic Beanstalk is more form based which means you need to tell what exactly you want to do with application for example route setup , scaling mechanism , application portability, application health management , Integration with external log aggregators etc. This is big learning curve to many people (including me :) ). Where as these with PCF these things are easy and straightforward and sometimes implicitly done.
Now Can I use pivotal cloud foundry with amazon? answer will be absolutely yes.
Pivotal cloud foundry is Wrapper written over open source Cloud Foundry project.
It is more succinct PaaS option than Amazon Beanstalk. You can host PCF on amazon ec2 ( IaaS )boxes using BOSH software. To answer you PCF is a alternative to Amazon Beanstalk. You don't need PCF is you want to use Amazon Beanstalk and vice versa.

Spring cloud Microservices on Azure Service Fabric

I am new to Microsoft Azure. I have worked on Microservices on Pivotal Cloud Foundry.
Can we deploy and run Spring Cloud Microservices on Azure Service Fabric?
Do they work same way as they run on Pivotal Cloud Foundry without any program changes?

Resources