I try to connect my spring application to the HCP Consul Discovery Service.
Running consul locally in dev mode works well.
consul agent -dev
application.yml file looks like this:
spring:
cloud:
consul:
host: localhost
port: 8500
However, when I try to connect to HCP Consul I get:
[catalogWatchTaskScheduler-1] org.springframework.cloud.consul.discovery.ConsulCatalogWatch: Error watching Consul CatalogServices
org.apache.http.conn.ConnectTimeoutException: Connect to HOST:8500 [HOST/IP] failed: Connect timed out
This is the configuration I use:
spring:
cloud:
consul:
host: HCP_HOST
port: 8500
scheme: https
HCP Consul is available to public connections. I manage to see the members using the CLI command
consul members
This is the dependency I use in the pom.xml file
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
<version>3.1.2</version>
</dependency>
What do I miss in my configuration?