istio - Istio ServiceEntry 作为虚拟主机和 VirtualService 可能吗?
问题描述
我有一个用例,我想使用 ServiceEntries 作为虚拟主机来为每个虚拟主机路由和配置目标规则。
(丑陋的)系统设置是:Kubernetes Service 调用一个外部 API(一个主机,一个 URI,不同的上游,由外部系统中的承载令牌路由)。我想在不同的“虚拟主机”之间切换 kubernetes 服务,并为每个虚拟主机配置连接限制以保护不同的外部上游。
Istio DNS 和 CNI 功能已激活。我尝试了类似以下的方法:
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: upstream-1
spec:
hosts:
- upstream-1
ports:
- number: 80
name: http
protocol: HTTP
resolution: DNS
location: MESH_EXTERNAL
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: upstream-1
spec:
hosts:
- upstream-1
http:
- route:
- destination:
host: httpbin.org
rewrite:
authority: httpbin.org
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: upstream-1
spec:
host: upstream-1
trafficPolicy:
connectionPool:
http:
h2UpgradePolicy: UPGRADE
我想请求 http://upstream-1 ,它应该被路由到http://httpbin.org并带有主机头“主机:httpbin.org”。并且应该使用 DestinationRule(这里是升级 http 连接的简单示例)。
这可能吗?在此示例中,似乎无法识别虚拟服务。
解决方案
推荐阅读
- file - 文件分割器tikz图片
- firebase - 为什么不能使用 firebase url 从 googlesheet 向 firebase 添加数据
- android - 具有 onClick 功能的嵌套 RecyclerView
- sabre - Sabre 中所做的更改不会立即反映在 API 中
- angular - RxJs - 动态地将相互依赖的同步调用添加到没有嵌套的 fork join
- javascript - Javascript 比较结果为单个对象数组,如果值在同一对象数组中匹配,则追加
- c++ - 创建 dll 时 applink.c 文件出现问题
- mysql - MySQL Where IN 必须匹配所有值
- veracode - ESAPI 的目的是什么?
- svelte - 使用不同的语言进行纤细的路由