istio配置重复的svc报错
现象:
两个vs中配置了同一个svc地址,导致其中的一个vs路由配置不生效,看到istiod服务的报错duplicate domain from service
解决:
istiod服务报错日志
2024-11-13T14:54:50.394181675+08:00 "pilot_vservice_dup_domain": {
2024-11-13T14:54:50.394188065+08:00 "xxx.svc.cluster.local:80": {
2024-11-13T14:54:50.394192825+08:00 "proxy": "xx-59cf68bfdf-x57d2.xx-ns",
2024-11-13T14:54:50.394197005+08:00 "message": "duplicate domain from service: xxx-api.xx-master.svc.cluster.local:80"
2024-11-13T14:54:50.394200645+08:00 }
2024-11-13T14:54:50.394204055+08:00 }
2024-11-13T14:54:50.394207575+08:00 }
配合istioctl的其它子命令进行验证
# 查看侦听器配置
istioctl proxy-config listeners xxx-pod.xx-ns |grep "xx"
10.99.46.36 80 Trans: raw_buffer; App: http/1.1,h2c Route: x.x-master.svc.cluster.local:80
10.99.46.36 80 ALL Cluster: outbound|80||mp-x.ns.svc.cluster.local
# 查看集群cluster配置
istioctl proxy-config clusters xx-pod.ns |grep "xx"
xx.ns.svc.cluster.local 80 - outbound EDS
xx.ns.svc.cluster.local 80 - outbound EDS
# 路由配置
istioctl proxy-config routes xx-pod.ns |grep -E "tts"
deploymentxx.ns.svc.cluster.local:80 deploymentxx.ns.svc.cluster.local:80 * /* svc1-name-virtualservice.ns
deploymentxx.ns.svc.cluster.local:80 deploymentxx.ns.svc.cluster.local:80 * /* svc1-name-virtualservice.ns
80 deploymentxx.ns.svc.cluster.local:80 svc1-name, svc1-name.ns + 1 more... /* svc2-virtualservice.ns
80 deploymentxx.ns.svc.cluster.local:80 svc2, svc2.ns + 1 more... /* svc-virtualservice.ns
将其中一个vs的hosts字段更改即可
此篇属于事后记录