Skip to content

Consul Discovery not work in native image #888

Description

@HydroCarbon

Describe the bug
When i use springboot and package in jar mode, consul discovery work fine.
but in native image, cannot registered right;

this is startup log:

Registering service with consul: NewService{id='ChainOS-User-5e3259808f16279d9d2143c9a4766423', name='ChainOS-User', tags=[], address='192.168.50.102', meta={group=ChainOS-User, secure=false}, port=18100, enableTagOverride=null, check=Check{script='null', dockerContainerID='null', shell='null', interval='10s', ttl='null', http='http://192.168.50.102:18100/actuator/health', method='null', header={}, tcp='null', timeout='5s', deregisterCriticalServiceAfter='10m', tlsSkipVerify=null, status='null', grpc='null', grpcUseTLS=null}, checks=null}

And this is my property:

spring:
  application:
    name: ChainOS-User
  threads:
    virtual:
      enabled: true
  cloud:
    consul:
      enabled: true
      host: 192.168.50.102
      port: 8500
      discovery:
        enabled: true
        instance-group: ${spring.application.name}
        service-name: ${spring.application.name}
        instance-id: ${spring.application.name}:${random.value}
        health-check-path: ${management.endpoints.web.base-path}/health
        health-check-interval: 10s
        health-check-timeout: 5s
        deregister: true
        health-check-critical-timeout: 10m
server:
  port: 18100
management:
  endpoints:
    web:
      base-path: /actuator
      exposure:
        include:
          - "health"
          - "env"
          - "grpcHealth"

And in consul ui:

Image

And curl consul catelog:

❯ curl http://localhost:8500/v1/catalog/service/ChainOS-User
[{"ID":"204c838f-4fb1-8668-12f1-0982a6b99709","Node":"consul-1","Address":"172.21.0.2","Datacenter":"dc1","TaggedAddresses":{"lan":"172.21.0.2","lan_ipv4":"172.21.0.2","wan":"172.21.0.2","wan_ipv4":"172.21.0.2"},"NodeMeta":{"consul-network-segment":"","consul-version":"1.21.1"},"ServiceKind":"","ServiceID":"ChainOS-User-5e3259808f16279d9d2143c9a4766423","ServiceName":"ChainOS-User","ServiceTags":[],"ServiceAddress":"192.168.50.102","ServiceTaggedAddresses":{"lan_ipv4":{"Address":"192.168.50.102","Port":18100},"wan_ipv4":{"Address":"192.168.50.102","Port":18100}},"ServiceWeights":{"Passing":1,"Warning":1},"ServiceMeta":{"group":"ChainOS-User","secure":"false"},"ServicePort":18100,"ServiceSocketPath":"","ServiceEnableTagOverride":false,"ServiceProxy":{"Mode":"","MeshGateway":{},"Expose":{}},"ServiceConnect":{},"ServiceLocality":null,"CreateIndex":133605,"ModifyIndex":133605}]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions