Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在K8s部署中使用Eureka作为服务发现,在configDB 中的数据库serverConfig使用Ingress 域名,为什么在8080 页面存在某些实例无法显示?但是通过ip:8080/health 显示是UP 状态。而使用在serverConfig 表中填lb配置的域名,则不会出现这个问题。 #4995

Closed
3 tasks
HadwinLing opened this issue Oct 13, 2023 · 10 comments
Labels

Comments

@HadwinLing
Copy link

描述bug

简洁明了地描述一下bug

复现

通过如下步骤可以复现:

期望

简介明了地描述你希望正常情况下应该发生什么

截图

如果可以,附上截图来描述你的问题

额外的细节和日志

  • 版本:
  • 错误日志
  • 配置:
  • 平台和操作系统
@HadwinLing HadwinLing changed the title 在K8s部署中使用Eureka作为服务发现,在configDB 中的数据库serverConfig使用Ingress 域名,为什么在8080 页面存在某些实例无法显示?但是通过ip:8080/health 显示是UP 状态。而使用在serverConfig 表中填lb配置的域名,则不会出现这个问题。版本1.5.0 在K8s部署中使用Eureka作为服务发现,在configDB 中的数据库serverConfig使用Ingress 域名,为什么在8080 页面存在某些实例无法显示?但是通过ip:8080/health 显示是UP 状态。而使用在serverConfig 表中填lb配置的域名,则不会出现这个问题。 Oct 13, 2023
@dosubot
Copy link

dosubot bot commented Oct 13, 2023

🤖

您遇到的问题可能是由于在application-kubernetes.properties文件中的配置设置。在这个文件中,eureka.client.enabledspring.cloud.discovery.enabled都被设置为false

这些设置禁用了Eureka服务发现和Spring Cloud Discovery。这意味着即使您的服务正在运行,它们也不会被发现并注册到Eureka,因此它们不会在8080页面上显示。

要解决这个问题,您应该通过将这些属性设置为true来启用Eureka服务发现和Spring Cloud Discovery:

eureka.client.enabled=true
spring.cloud.discovery.enabled=true

做了这些更改后,您的服务应该能被Eureka发现并在8080页面上显示。

在您分享的上下文中,Apollo 1.5.0版本确实支持在Kubernetes部署中使用Eureka进行服务发现。然而,需要注意的是,eureka.service.url配置不适用于基于Kubernetes的原生服务发现场景。apollo-configservice和apollo-adminservice都需要注册到Eureka服务,所以需要配置Eureka服务地址。eureka.instanceeureka.server配置表明Eureka被用于服务发现。然而,eureka.client.fetch-registryeureka.client.registerWithEureka属性被设置为false,这意味着这个服务不会获取Eureka注册表,也不会将自己注册到Eureka。这些设置可以根据您的部署需求进行更改。此外,eureka.client.serviceUrl.defaultZone被设置为http://${eureka.instance.hostname}:8080/eureka/,这将被ApolloConfigDB.ServerConfig或系统属性中的eureka.service.url设置覆盖。

application-kubernetes.properties文件中的eureka.client.enabledspring.cloud.discovery.enabled属性用于控制Spring Cloud应用中的服务发现机制。

  1. eureka.client.enabled:此属性用于启用或禁用Eureka客户端。Eureka是Netflix的一种服务发现工具,通常用于微服务架构。当此属性设置为false时,意味着Eureka客户端被禁用,应用程序不会将自己注册到Eureka服务器,也不会试图通过Eureka服务器发现其他服务。

  2. spring.cloud.discovery.enabled:此属性是Spring Cloud DiscoveryClient实现的一般开关。当此属性设置为false时,意味着DiscoveryClient被禁用,应用程序不会试图发现其他服务,无论使用的是哪种特定的发现服务(Eureka,Consul等)。

在您分享的上下文中,这两个属性都被设置为false,这意味着应用程序没有使用任何服务发现机制。这在Kubernetes环境中很常见,因为服务发现通常由Kubernetes本身处理,而不是由各个应用程序处理。此外,apollo.eureka.server.enabled属性也被设置为false,表明Apollo配置管理系统没有使用自己的Eureka服务器进行服务发现。

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@nobodyiam
Copy link
Member

eureka.service.url 需要填写所有 eureka server 的地址从而可以实现数据同步,这个是 eureka 的数据同步机制决定的

image

Copy link

stale bot commented Nov 16, 2023

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 16, 2023
@Dr-wgy
Copy link

Dr-wgy commented Nov 21, 2023

我这边使用apollo 有个发现 发现 apollo-admin-service 已经挂了 但是[eureka] 上面还是显示服务还存在 感觉 eureka拆除不健康的服务会慢吗?

@stale stale bot removed the stale label Nov 21, 2023
@Dr-wgy
Copy link

Dr-wgy commented Nov 21, 2023

DiscoveryClient-HeartbeatExecutor-0
image
image
健康检查不过但是还在上报up

@nobodyiam
Copy link
Member

eureka 的默认剔除时间是 90 秒,可以自行调整

@Dr-wgy
Copy link

Dr-wgy commented Nov 24, 2023

eureka 的默认剔除时间是 90 秒

我在想我这个和自动剔除是不是有关系? 我这个服务因为 #3405 oom
但是我一直看了 这个上报 还是一直是up 是不是不应该服务上报的up状态 应该server主动检查
还有我看了一下portal 代码看起来刷新 admin-service也很慢,最少得5min(因为eureka 剔除服务比较慢 默认90秒)
private static final long NORMAL_REFRESH_INTERVAL = 5 * 60 * 1000;

image

@nobodyiam
Copy link
Member

上报的状态是由 AdminServiceHealthIndicator 定义的

Copy link

stale bot commented Dec 26, 2023

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 26, 2023
Copy link

stale bot commented Jan 3, 2024

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.

@stale stale bot closed this as completed Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants