我目前正在检查是否能够根据serviceentry名称连接外部端点,以便轻松切换serviceentry中配置的主机。以下是我正在使用的当前配置,并且还在istio-config 中启用了ISTIO_META_DNS_CAPTURE: "true"
---
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: elasticsearch-cluster-dev
spec:
exportTo:
- .
hosts:
- dev-elastic.es.europe-west1.gcp.cloud.es.io
location: MESH_EXTERNAL
ports:
- name: https
number: 443
protocol: TLS
resolution: DNS
但是到elasticsearch集群dev的连接请求返回Could not resolve host
root@nginx:/# curl https://elasticsearch-cluster-dev
curl: (6) Could not resolve host: elasticsearch-cluster-dev
root@nginx:/#
我们可以根据istio中的ServiceEntry名称连接到外部端点吗?我是否缺少任何istio配置?
ServiceEntry名称只是Istio的元信息。它不表示任何主机信息。您应该使用主机url。据我所知,基于名称的切换是不可能的
curl https://dev-elastic.es.europe-west1.gcp.cloud.es.io