spring-cloud-kubernetes: Spring Cloud Gateway's Service Discovery with Spring Cloud Kubernetes not working in Greenwich.M3?
I’ve been trying to get Spring Cloud Gateway working with Spring Security and so I’ve moved to Greenwitch M3. I’ve managed to get security working but now I’m unable to get the gateway to correctly pick up all my downstream services.
Visiting one of my downstream services endpoints gets me a 500 error. No exceptions are thrown on my logs.
I’ve tried to printout all the services that the DiscoveryClient finds like so:
@Bean
CommandLineRunner discoveryClientRunner(DiscoveryClient client) {
return new CommandLineRunner() {
@Override
public void run(String... args) throws Exception {
System.out.println("Available Services:");
client.getServices().forEach(System.out::println);
}
};
}
I get a nice list of all my services.
For debugging purposes I’ve enabled /actuator/gateway/routes and when I visit it I get a:
There was an unexpected error (type=Internal Server Error, status=500).
No stack traces on my logs.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 42 (24 by maintainers)
Commits related to this issue
- Prevent NPE if k8s Client returns null for metadata and/or annotations Fixes #282 — committed to geoand/spring-cloud-kubernetes by geoand 6 years ago
- Prevent NPE if k8s Client returns null for metadata and/or annotations (#283) Fixes #282 — committed to spring-cloud/spring-cloud-kubernetes by geoand 6 years ago
- Uses KubernetesDiscoveryClient as return type so ConditionalOnMissingBean will function correctly. Also removes extension from KubernetesDiscoveryProperties See gh-282 — committed to spring-cloud/spring-cloud-kubernetes by spencergibb 6 years ago
NPE was solved.
Thank you.
This works!
Both the
actuator/gateway/routesand communicating to the downstream services works as expected! 👍