k8s 环境下 Spring Cloud Gateway 服务注册到 nacos 集群报错

来源:12-7 搭建生产可用的Nacos集群

慕尼黑4347840

2021-06-01

k8s 环境下,nacos 集群,业务服务启动后注册失败
nacos 1.4.1, 业务服务 spring boot 2.1.17,spring cloud G.SR6 , Spring cloud alibaba 2.1.4
报错:
com.alibaba.nacos.api.exception.NacosException: failed to req API:/nacos/v1/ns/instance after all servers([nacos-0.nacos-headless.nacos.svc.cluster.local:8848]) tried: ErrCode:400, ErrMsg:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Jun 01 16:18:18 CST 2021
There was an unexpected error (type=Bad Request, status=400).
receive invalid redirect request from peer 172.20.10.203

写回答

1回答

大目

2021-06-08

您好,spring boot/spring cloud/spring cloud alibaba版本目测OK的。

这个异常是说nacos client无法连接nacos server。

建议从两个方向排查:

  1. 网络问题。进入到你报错的微服务,curl nacos-0.nacos-headless.nacos.svc.cluster.local:8848,看是否能访问(应该是OK的,否则不应该是400,而是网络超时)

  2. 检查nacos client和nacos server版本是否兼容。建议看下你应用的nacos client版本,然后使用相同版本的nacos server。(这种可能性更大)

0
0

Spring Cloud Alibaba微服务从入门到进阶

面向未来微服务:熟练掌握Spring Cloud Alibaba

3129 学习 · 1327 问题

查看课程