Feign client not able to make calls- Kubernetes

有些话、适合烂在心里 提交于 2019-12-02 20:06:26

问题


I have deployed microservice on docker-desktop for windows and feign is not able to make a call to another service.

person ms calling organization ms through feign. I can see in the logs of person pod

 2019-11-10 12:58:34.000  INFO [personservice,13631e6ef2efe358,15c75b9a4006485a,true] 6 --- [ionThreadPool-1] c.p.service.OrganizationServiceData      : Get the value from the organization ms hystrix-organizationThreadPool-1
2019-11-10 12:58:34.293  INFO [personservice,13631e6ef2efe358,e0bbcecf5f7c349f,true] 6 --- [zationservice-1] c.netflix.config.ChainedDynamicProperty  : Flipping property: organizationservice.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2019-11-10 12:58:34.319  INFO [personservice,13631e6ef2efe358,e0bbcecf5f7c349f,true] 6 --- [zationservice-1] c.netflix.loadbalancer.BaseLoadBalancer  : Client: organizationservice instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=organizationservice,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
2019-11-10 12:58:34.332  INFO [personservice,13631e6ef2efe358,e0bbcecf5f7c349f,true] 6 --- [zationservice-1] c.n.l.DynamicServerListLoadBalancer      : Using serverListUpdater PollingServerListUpdater
2019-11-10 12:58:34.535  INFO [personservice,13631e6ef2efe358,e0bbcecf5f7c349f,true] 6 --- [zationservice-1] c.netflix.config.ChainedDynamicProperty  : Flipping property: organizationservice.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2019-11-10 12:58:34.556  INFO [personservice,13631e6ef2efe358,e0bbcecf5f7c349f,true] 6 --- [zationservice-1] c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client organizationservice initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=organizationservice,current list of Servers=[10.1.0.190:8085],Load balancer stats=Zone stats: {unknown=[Zone:unknown; Instance count:1;       Active connections count: 0;       Circuit breaker tripped count: 0;       Active connections per server: 0.0;]
},Server stats: [[Server:10.1.0.190:8085;       Zone:UNKNOWN;   Total Requests:0;       Successive connection failure:0;        Total blackout seconds:0;       Last connection made:Thu Jan 01 00:00:00 GMT 1970;
First connection made: Thu Jan 01 00:00:00 GMT 1970;    Active Connections:0;   total failure count in last (1000) msecs:0;     average resp time:0.0;  90 percentile resp time:0.0;    95 percentile resp time:0.0;       min resp time:0.0;      max resp time:0.0;      stddev resp time:0.0]
]}ServerList:org.springframework.cloud.kubernetes.ribbon.KubernetesServerList@5bae3a6b
2019-11-10 12:58:35.345  INFO [personservice,,,] 6 --- [erListUpdater-0] c.netflix.config.ChainedDynamicProperty  : Flipping property: organizationservice.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2019-11-10 12:58:35.502  INFO [personservice,13631e6ef2efe358,15c75b9a4006485a,true] 6 --- [ionThreadPool-1] c.p.service.OrganizationServiceData      : calling fallback method to get the organization data for id 1

The ribbon client gets the IP-address of the pod running organization service. current list of Servers=[10.1.0.190:8085]

Here is my person service application.yml

spring:
  cloud:
    kubernetes:
      ribbon:
          mode: SERVICE
organizationservice:
        ribbon:
            MaxAutoRetries: 2
            MaxAutoRetriesNextServer: 0
            OkToRetryOnAllOperations: true
            ServerListRefreshInterval: 2000
            ConnectTimeout: 10000
            ReadTimeout: 1000

person ms dependecy

compile "org.springframework.cloud:spring-cloud-starter-kubernetes-all"
compile('org.springframework.cloud:spring-cloud-starter-netflix-ribbon')

upon checking the logs for organization pod. No calls have been made to it.

Edit 1: Upon changing the log level for feign in person service I found that JWT token is begin passed by default. I solved the issue using filters but the same application was working with out filters when I was using not using spring cloud kubernetes.

来源:https://stackoverflow.com/questions/58789632/feign-client-not-able-to-make-calls-kubernetes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!