fix(NacosEventListener): 修复在容器中部署的时候,eureka会将自己的hostname取出来作为服务的hostname的问题#12
Open
jimersylee wants to merge 1 commit intoinacos:masterfrom
Open
fix(NacosEventListener): 修复在容器中部署的时候,eureka会将自己的hostname取出来作为服务的hostname的问题#12jimersylee wants to merge 1 commit intoinacos:masterfrom
jimersylee wants to merge 1 commit intoinacos:masterfrom
Conversation
…ame的问题 k8s部署时,k8s服务会自动给容器添加一条hosts,这个hostname在其他服务中是无法访问的,如10.42.1.182 deveureka-7f68f7c7fd-z87nf,因此使用服务的ip作为hostname,不会有问题
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
k8s部署时,k8s服务会自动给容器添加一条hosts,这个hostname在其他服务中是无法访问的,如10.42.1.182 deveureka-7f68f7c7fd-z87nf,因此使用服务的ip作为hostname,不会有问题;否则会出现网关转发给服务请求时,会去解析eureka的hostname,无法解析,或者服务间feigin调用的时候,也用这个错误的hostname,无法调用
错误例子:
访问eureka的接口,http://ip/eureka/apps,hostName为eureka的hostname,此时服务间无法正常调用
修改代码后访问eureka的接口 ip/eureka/apps,hostName与ipAddr一致,可以正常使用