Understanding Eureka <--> Configservice cycle - spring-cloud

I'm trying to find out what's the best way to solve this conundrum.
I'd like Eureka to be able to pick configuration dynamically from the Config Server (Eureka depending on Config)
Id' like Config to be found through Eureka, to avoid hardcoding Config's URI in every single microservice (Config depends on Eureka)
spring:
cloud:
enabled: true
config:
fail-fast: true
discovery:
enabled: true
serviceId: configserver
When I startup Eureka, she doesn't know where Config is, so she cannot pick anything from it. What's the best approach to solve this problem?

In your Eureka bootstrap.yml:
spring:
application:
name: your_config_file_name
cloud:
config:
enabled: true
failFast: true
uri: the_uri_of_the_config_server

Related

k8s scdf2 how config volumenMount in a task (no freetext)

Deploying a task, as user, i need config k8s params like i do using "freetext".
The k8s config is following
Secret: "kind": "Secret","apiVersion": "v1","metadata": {"name": "omni-secret","namespace": "default",
bootstrap.yml:
spring:
application:
name: mk-adobe-analytics-task
cloud:
kubernetes:
config:
enabled: false
secrets:
enabled: true
namespace: default
paths:
- /etc/secret-volume
log.info(AdobeAnalyticsConstants.LOG_RECOVERING_SECRET, env.getProperty("aws.bucketname"));
Deploying task:
task launch test-007 --properties "deployer.*.kubernetes.volumeMounts=[{name: secret-volume, mountPath: '/etc/secret-volume'}], deployer.* .kubernetes.volumes=[{name: 'secret-volume', secret: {secretName: 'omni-secret' }}]"
Result:
2019-06-10 10:32:50.852 INFO 1 --- Recovering property "aws.bucketname": null
How can i map into a task the k8s volumens? simply k8s deploy , it is ok using streams
it's not clear how to start with your issue but please take a look for Kubernetes PropertySource implementations.
Inside "Secrets PropertySource - Table 3.2. Properties" you can find other settings like:
- spring.cloud.kubernetes.secrets.name
- spring.cloud.kubernetes.secrets.labels
- spring.cloud.kubernetes.secrets.enableApi
So please refer to the documentation.
It's also possible that your environment variable aws.bucketname wasn't configured properly.
Hope this help.

Netflix Eureka and Spring Boot Admin in one application, not showing clients

i'm trying to add Spring Boot Admin to my Eureka Server, but it looks like there is something wrong somewhere.
I'm using
Spring Boot version 2.1.5.RELEASE (starter parent)
spring-cloud-starter-netflix-eureka-server
spring-boot-admin-starter-server
My Main Class is annotated with
#SpringBootApplication
#EnableAdminServer
#EnableEurekaServer
And this is the application.yml
spring:
application:
name: eureka-server
boot:
admin:
context-path: /admin
security:
basic:
enabled: false
management:
security:
enabled: false
eureka:
client:
register-with-eureka: false
fetch-registry: true
instance:
leaseRenewalIntervalInSeconds: 15
After i started the server, i try to launch a microservice
The application.yaml go the client is the following:
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
leaseExpirationDurationInSeconds: 5
client:
service-url:
default-zone: http://localhost:8761/eureka
healthcheck:
enabled: true
lease:
duration: 5
management:
endpoints:
web:
exposure:
include: '*'
security:
enabled: false
but i see it in eureka as down
and i cannot see anything in SBA

Backend services isolation in Zuul

We are planning using Zuul in production as an API gateway. I am not sure the behavior of Zuul in this specific scenario.
Suppose there are two back-end services A and B sitting behind Zuul. Service A is a slow one but with a lot of traffic. What will happen to the clients visiting Service B through Zuul?
On the clients' side, Service B will be unavailable because Service A slow down the Zuul so there is no resource to handle the request for Service B.
I'm not sure about this, and any advice or experience will be much appreciated.
You can configure the individual endpoints to use their own thread pools and have their own timeouts.
zuul:
ribbonIsolationStrategy: THREAD
threadPool:
useSeparateThreadPools: true
host:
connect-timeout-millis: 60000
socket-timeout-millis: 60000
routes:
examples2:
path: /something/**
serviceId: examples
stripPrefix: true
services:
path: /services/**
serviceId: services
stripPrefix: false
sensitiveHeaders: true
auth:
path: /oauth/**
serviceId: saapi-auth-server
stripPrefix: false
sensitiveHeaders: true
hystrix:
command:
default:
execution:
timeout:
enabled: false
isolation:
thread:
timeoutInMilliseconds: 60000
auth:
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
services:
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
Here is an example config from one of our gateways that should get you started.

Spring Cloud Config + Eureka + Zuul - not seeing properties in clients

I am developing an application with microservice-based arhitecture using Spring Cloud.
I have four applications currently in project:
config-server, eureka-server, gateway-service(zuul) and eureka-client which I am using just to test that the project works as intended.
But I have a problem fetching properties from the config-server.
I have a git repository in which I have one file, eureka-client.yml.
This file has one property message: test message.
I can see that the property is loaded into the config-server if I go to http://localhost:8888/eureka-client/default.
But when I access the property in my eureka-client it returns null.
environment.getProperty("message");
Could someone tell me what am I doing wrong? I'm probably just missing a configuration or .yml property but can't find out which one.
Also the clients are supposed to fetch the properties from the config-server through Eureka.
EDIT:
eureka-server - application.yml
server:
port: 8761
eureka:
instance:
hostname: localhost
client:
register-with-eureka: false
fetch-registry: false
service-url:
default-zone: http://${eureka.instance.hostname}:${server.port}/eureka/
eureka-client - application.yml
server:
port: 8082
And annotated with #EnableDiscoveryClient
config-server - application.yml
server:
port: 8888
spring:
cloud:
config:
server:
git:
uri: https://github.com/bpuscasu/config-server
And annotated with #EnableConfigServer and #EnableDiscoveryClient

Unable to run Spring Cloud Config-Server in Eureka First Bootstrap mode

*****Config Server- Application Service Setup*****
Below is the configuration from application.yml
server:
port: 8882
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
spring:
cloud:
config:
server:
git:uri: https://github.com/appleman/config
Below is the configuration from boostrap.yml
spring:
application:
name: configserver
Starting of this plain spring boot application registers config-server to Eureka.
**General Eureka Server is running on 8761 port
********Below is the Application Client configuration*****
Below is the Application Client configuration in my bootstrap.yml
spring:
application:
name: contractService,envDEV13
cloud:
config:
enabled: true
discovery:
enabled: true
serviceId: configserver
eureka:
instance:
nonSecurePort: ${server.port:8080}
client:
serviceUrl:
defaultZone: http://${eureka.host:localhost}:${eureka.port:8761}/eureka/
Injection of properties in Spring Controller like the below snippet is not working.
#Value("${creditService.eppDbUrl}")
String bar;
Please suggest us if we are doing anything wrong.