kubernetes - `ServiceEntry` 可以仅应用于一项服务吗?
问题描述
我们有一个带有 Istio 的集群,但是有一个条件,我找不到如何满足。
我们需要其中一项服务在网格内也有一定的限制,并与一个外部端点通信。通过Sidecar
对象,我应该能够在内部设置限制,但我不知道如何限制到一个外部端点。
我也可以在对象中设置外部端点Sidecar
,但无论如何我都必须创建一个ServiceEntry
,在这种情况下,所有服务都可以与该外部端点通信。
似乎我需要ServiceEntry
为一项特定服务设置一个,但这是不可能的。有没有其他方法可以实现这一目标?
解决方案
我在 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
推荐阅读
- jquery - JQuery自动完成查找上的最大调用堆栈大小超出错误
- angular - Asp.net 核心错误的角度上传:System.Text.DecoderFallbackException:无法翻译索引处的字节 [FF]
- unicode - UAX#14 与 libunibreak 和多语言的单行文本
- django - Django 模型类型
- html - 如何并排设置图像和文本
- python - 嵌套的 for-while 循环在第一次运行后停止迭代
- c# - 如何在 WPF 桌面应用程序的 XAML 中将 System.Windows.Controls.Image 设置为静态
- mysql - 像这样的密码 $5$rounds=5000$/mLhDmcPo
- kubernetes - 如何在部署前将环境变量注入 Kubernetes Pod
- docker - Jenkins Pipeline 构建 Dockerfile 但无法在容器内运行步骤