一个 "ServiceEntry "可以只应用于1个服务吗?

问题描述 投票:0回答:1

我们用Istio做了一个集群,但是有一个条件,我找不到如何满足。

我们需要其中一个服务在mesh内也有一定的限制,并且要和一个外部端点对话。通过 Sidecar 对象,我应该可以在内部设置限制,但我不知道如何限制一个外部端点。

我可以将外部端点设置在 Sidecar 对象,但我必须创建一个类似于 ServiceEntry 反正,在这种情况下,所有的服务都可以与该外部端点对话。

看来,我需要的是设置一个叫做 ServiceEntry 但这是不可能的。有没有其他方法可以实现?

kubernetes istio
1个回答
3
投票

我问了这个问题 问题在GitHub上;到Istio团队,而实现这一目的的唯一方法就是将服务放在不同的命名空间,并使之成为一个。ServiceEntry 只适用于该命名空间的工作负载,通过 exportTo 参数。

ServiceEntry 会是这样的。

apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
  name: se-demo
spec:
  exportTo:
  - .                 # with ".", we are saying the ServiceEntry to only apply to the workloads in the same namespace.
  hosts:
  - www.google.com
  location: MESH_EXTERNAL
  ports:
  - name: https
    number: 443
    protocol: HTTPS
  resolution: DNS
© www.soinside.com 2019 - 2024. All rights reserved.