istio中serviceentry结合egressgateway的使用

假设有一个外部服务,外部服务ip为:10.10.102.90,其中32033为v1版本,32034为v2版本。

现在需要把这个服务引入到istio中,并且需要配置所有访问该服务的流量都通过egressgateway转发出去。

serviceentry

复制代码
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
  name: gin-service-entry
spec:
  endpoints:
  - address: 10.10.102.90
    labels:
      version: v1
    ports:
      http: 32033
  - address: 10.10.102.90
    labels:
      version: v2
    ports:
      http: 32034
  hosts:
  - gin.test.ch
  location: MESH_EXTERNAL
  ports:
  - name: http
    number: 80
    protocol: HTTP
  resolution: STATIC

gateway

复制代码
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
  name: gin-egressgateway
spec:
  selector:
    istio: egressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - gin.test.ch

dr

复制代码
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: egressgateway-for-gin
  namespace: istio-system
spec:
  host: istio-egressgateway-1-19-6.istio-system.svc.cluster.local
  subsets:
  - name: gin

vs

复制代码
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: direct-gin-through-egress-gateway
spec:
  gateways:
  - gin-egressgateway
  - mesh
  hosts:
  - gin.test.ch
  http:
  - match:
    - gateways:
      - mesh
      port: 80
    route:
    - destination:
        host: istio-egressgateway-1-19-6.istio-system.svc.cluster.local
        port:
          number: 80
        subset: gin
      weight: 100
  - match:
    - gateways:
      - gin-egressgateway
      port: 80
    route:
    - destination:
        host: gin.test.ch
        port:
          number: 80
      weight: 100
相关推荐
阿里云云原生9 小时前
【昨晚 17:00】模力工场联合 HiClaw,聊聊怎么把虾场管明白
云原生
阿里云云原生12 小时前
连登顶会!阿里云多项研究成果大幅提升运维智能精度与效率
云原生
阿里云云原生12 小时前
从养一只虾到开好虾场,HiClaw 规模化养虾的详细解读
云原生
河码匠14 小时前
Kubernests YAML 详细之卷(PV、PVC、StorageClass)
云原生·容器·kubernetes
码上上班14 小时前
k8s控制器,daemonset
云原生·容器·kubernetes
深念Y15 小时前
Docker Desktop 版本与 IDEA 插件兼容性
docker·云原生·容器·api·idea·wsl
llm大模型算法工程师weng17 小时前
AI + Docker + K8s:云原生时代的运维提效实战
运维·人工智能·云原生
步步为营DotNet18 小时前
全面解读C# 14在云原生微服务开发中的创新应用
微服务·云原生·c#
平行云PVT1 天前
数字孪生信创云渲染技术解析:从混合信创到全国产化架构
linux·unity·云原生·ue5·图形渲染·webgl·gpu算力
heimeiyingwang1 天前
【架构实战】云原生架构设计原则
云原生·架构