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
相关推荐
匀泪6 小时前
云原生(nginx实验(1))
nginx·云原生
小义_7 小时前
【RH134知识点问答题】第11章 管理网络安全
linux·安全·web安全·云原生
@hdd7 小时前
Deployment 与 ReplicaSet:副本管理与滚动更新
云原生·kubernetes
没有bug.的程序员7 小时前
云原生安全深潜:K8s RBAC 权限模型内核、服务账户生命周期与权限最小化实战指南
安全·云原生·kubernetes·k8s·rbac·权限模型·服务账户
三点水-here21 小时前
05 - 大模型推理生产架构设计:混合部署与Kubernetes实战
云原生·容器·kubernetes·hpa·混合架构·gpu调度
海兰1 天前
Elastic Stack 技术栈与无服务器架构核心指南
云原生·架构·serverless
认真的薛薛1 天前
3.k8s-暴露pod和service
云原生·容器·kubernetes
Alice_whj1 天前
AI云原生笔记
人工智能·笔记·云原生
人间打气筒(Ada)1 天前
Kubernetes核心技术-service详解
云原生·容器·kubernetes·云计算·devops·service·service代理
匀泪1 天前
云原生(nginx环境设定)
java·nginx·云原生