使用 istio 将出站流量路由到网格内部
在我的设置中,我没有启用 istio 网关。我正在将服务和应用程序迁移到 K8S。该应用程序与之通信的一些服务位于集群内,这些服务之前是通过 elb 访问的,更改端点需要停机,因此希望将发往公共端点的流量直接路由到集群内的服务端点。
我的设置如下。
---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: my-site-se
namespace: site
spec:
hosts:
- my.example.com
location: MESH_EXTERNAL
ports:
- name: mytraffic
number: 9009
protocol: HTTP
resolution: NONE
我的 VirtualService 定义。
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my_site
namespace: site
spec:
hosts:
- my.example.com
http:
- match:
- port: 9009
name: myapp-route
route:
- destination:
host: myapp.site.svc.cluster.local
此外,应用程序 pod 没有启用 istio。
In my setup I don't have istio gateway enabled. I am migrating services and application to K8S. Some of the services that this application talks to is within cluster which were previously reached via elb, changing the endpoint requires a downtime, hence wanted to route traffic that is destined to public endpoint directly to service endpoint within the cluster.
My setup is below.
---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: my-site-se
namespace: site
spec:
hosts:
- my.example.com
location: MESH_EXTERNAL
ports:
- name: mytraffic
number: 9009
protocol: HTTP
resolution: NONE
My VirtualService definition.
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my_site
namespace: site
spec:
hosts:
- my.example.com
http:
- match:
- port: 9009
name: myapp-route
route:
- destination:
host: myapp.site.svc.cluster.local
Also application pod doesn't have istio enabled.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论