为什么使用istio tcp route无法通过ip访问服务?

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

当我使用这个VS时,我可以通过1.2.3.4访问我的http服务,但是当我将http更改为tcp时,我无法通过1.2.3.4访问我的http服务,这是怎么回事?

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: httpbin-vir
spec:
  hosts:
    - httpbin.default.svc.cluster.local
    - 1.2.3.4
  http:
    - match:
        - port: 8000
          sourceLabels:
            version: base
      route:
        - destination:
            host: httpbin.default.svc.cluster.local
            subset: base
    - match:
        - port: 8000
          sourceLabels:
            version: feature
      route:
        - destination:
            host: httpbin.default.svc.cluster.local
            subset: feature
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: httpbin-vir
spec:
  hosts:
    - httpbin.default.svc.cluster.local
    - 1.2.3.4
  tcp:
    - match:
        - port: 8000
          sourceLabels:
            version: base
      route:
        - destination:
            host: httpbin.default.svc.cluster.local
            subset: base
    - match:
        - port: 8000
          sourceLabels:
            version: feature
      route:
        - destination:
            host: httpbin.default.svc.cluster.local
            subset: feature

如果这个方法不行,我想知道如何在TCP路由下通过1.2.3.4访问我的服务

istio envoyproxy
© www.soinside.com 2019 - 2024. All rights reserved.