Spring Cloud Consul - Service Not Registering a Contactable Address on K8s Spring Cloud Consul - Service Not Registering a Contactable Address on K8s kubernetes kubernetes

Spring Cloud Consul - Service Not Registering a Contactable Address on K8s


Found the solution!

spring.cloud.consul.discovery.health-check-url=http://${spring.application.name}-my-openshift-route-url/actuator/healthspring.cloud.consul.discovery.hostname=${spring.application.name}-my-openshift-route-urlspring.cloud.consul.discovery.port=80spring.cloud.consul.discovery.scheme=http

So set

spring.cloud.consul.discovery.prefer-ip-address=falsespring.cloud.consul.discovery.prefer-agent-address=false

both to false and add the lines from the top block and you should be golden. Please note that spring.application.name needs to be the same as your OpenShift service name.