【问题反馈】部分 nacos node 获取到了过期的 instance IP 数据
Describe the bug A clear and concise description of what the bug is.
We have a nacos cluster with 3 nodes. The user's service is deployed on the K8s Pod, and the published service is a "temporary service". A Pod on the user's side is restarted, and the Pod IP has changed. The user uses the Nacos client to obtain the Pod IP before the restart from one of the nacos node IPs (abnormal data), and obtains the new Pod IP from the other two nacos node IPs (normal data). Moreover, from the front-end pages of the 3 nacos nodes, the instance IPs under this service are all new Pod IPs (normal data).
我们有个 nacos 集群,3个节点。用户的服务部署在 K8s 的 Pod 上,发布的是“临时服务”。 用户那边有一个 Pod 发生重启,Pod IP 发生了变化。 用户用 Nacos client 从其中一个 nacos node IP 上获取的仍然是重启前的 Pod IP(异常数据),从其他两个 nacos node IP 获取的都是新的 Pod IP(正常数据)。并且,从 3 个 nacos node 的前端页面,看到的这个 service 下的 instance IP 都是新的 Pod IP(正常数据)。
Expected behavior A clear and concise description of what you expected to happen.
It is expected that the latest Pod IP will be obtained from each nacos node 期望从每个 nacos node 上获取的都是最新的 Pod IP
Actually behavior A clear and concise description of what you actually to happen.
One of the nacos nodes obtained the old Pod IP data 其中有一个 nacos node 上获取的是老的 Pod IP 数据
How to Reproduce Steps to reproduce the behavior: 1、搭建一个三节点的 nacos 集群 2、用 K8s Pod 启动一个 Nacos 发布一个临时实例 3、重启这个 Pod,重新发布一个新的临时实例,IP 发生变化 4、使用 namingService.getAllInstance() ,分别从 3 个 nacos node 获取,期望都是最新的 Pod IP
Desktop (please complete the following information):
- OS: [e.g. Centos]
- Version [nacos-server 2.1.2]
- Module [naming]
- SDK [original]
Additional context Add any other context about the problem here.
需要提供一下yaml中关于nacos环境变量的配置。重启pod一般IP会变,首先要使用域名模式
有几种情况可能导致:
- 这个服务存在代理注册(如同步服务)等其他服务也进行了注册, 即之前有2个同ip同端口的服务实例,展示数据时进行了聚合,误以为是没移除。(通过naming-server.log,过滤这个服务相关日志,如果在该pod下线时,所有nacos节点都有移除该实例的日志,大概率是这个场景)。
- pod虽然表面销毁了, 但是实际进程还运行在node中,和nacos保持连接并持续发送心跳,nacos认为连接存活,因此不摘除实例数据,俗称幽灵pod(通常发生在pod非正常移除,或node非正常剔除集群时,少量正常停止pod时也会因k8s的bug出现,可通过naming-server.log,过滤这个服务相关日志,如果在该pod下线时,没有对应的实例移除日志确定)
- 使用了有bug的版本,目前好像2.2.X版本有一个异常中断连接时(比如Down机或者断网),会识别不到网络断开的场景,导致数据未被移除,如果使用这个版本,建议升级。
- Nacos集群搭建有问题,或者Nacos集群之间网络有问题,导致数据同步、心跳续约出现异常,通过nacos-cluster.log、protocol-distro 等日志查看。
No more response from author for a long time, and this problem seems env problem.