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

这个组件生成的serviceEntry在实际应用中无法调用istio集群外部的服务。 #4

Open
shuiyunwudi opened this issue Feb 10, 2022 · 1 comment

Comments

@shuiyunwudi
Copy link

shuiyunwudi commented Feb 10, 2022

1、软件环境版本:
consul: 1.8.4
istio: 1.11.4

2、情形描述:
以下是该组件同步自动生成的serviceEntry的完整内容:

apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
creationTimestamp: "2022-02-10T08:23:43Z"
generation: 3
labels:
manager: Aeraki
registry: consul
name: demo555.service.consul
namespace: istio-system
resourceVersion: "86920747"
uid: fac9b44c-7bf3-40e6-b069-35c112743248
spec:
endpoints:

  • address: 11.111.1.250
    labels: {}
    locality: dc2
    ports:
    tcp: 9093
    hosts:
  • demo555.service.consul
    location: MESH_INTERNAL
    ports:
  • name: tcp
    number: 9093
    protocol: TCP
    targetPort: 9093
    resolution: STATIC

当我在k8s上其他istio集群的应用里调用该外部服务时,会报"502 gateway", 错误。
但是当我参照官网,自己写serviceEntry的内容,如下:

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: demo555.service.consul
spec:
endpoints:

  • address: 11.111.1.250
    hosts:
  • demo555.service.consul
    ports:
  • number: 9093
    name: http
    protocol: HTTP
    resolution: STATIC
    location: MESH_INTERNAL

调用就可以成功,不知道是哪里的原因?怎么样修改源代码,来生成正确的serviceEntry定义?

@shuiyunwudi
Copy link
Author

我似乎找到答案了,consul上的服务定义里需要加入meta信息,指明服务的协议类型,生成的serviceEntry就不会是默认的tcp协议的了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant