如何使用其域将内部服务路由到外部服务

时间:2018-12-10 03:33:06

标签: kubernetes istio

我将istio 1.0.2版本与istio-demo-auth.yaml一起使用,我在k8s群集之外有一个mssql服务,我想通过使用外部db域'outside.db.com'+ 32433端口进行连接。我创建了一个ServiceEntry和VirtualService来将“ mssql-master”路由到外部服务“ outside.db.com”,但是它不能工作。 以下是我的Yamls:

---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: mssql-route
  namespace: multitenancy
spec:
  hosts:
  - mssql-master.multitenancy.svc.cluster.local
  http:
  - route:
    - destination:
        host: outside.db.com
      weight: 100

---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: mssql-dns
  namespace: multitenancy
spec:
  hosts:
  - outside.db.com
  location: MESH_EXTERNAL
  ports:
  - number: 32433
    name: tcp-mssql
    protocol: TCP
  resolution: DNS
---
apiVersion: v1
kind: Service
metadata:
  name: mssql-master
  namespace: multitenancy
  labels:
    app: mssql
spec:
  ports:
    - port: 2433
      targetPort: 32433
      protocol: TCP

由于某种原因,我无法使用externalIP替换外部db的域。那么,有没有办法通过其域路由到外部db?

0 个答案:

没有答案