aibangjuxin / knowledge

My knowledge
1 stars 0 forks source link

Istio #122

Open aibangjuxin opened 8 months ago

aibangjuxin commented 8 months ago

Istio 部署类型

graph LR
subgraph 部署类型
    gateway --> virtualservice
    virtualservice --> destinationrule
    destinationrule --> serviceentry
end

部署类型之间的关系

Gateway

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"

VirtualService

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: my-virtualservice
spec:
  hosts:
  - my-service.example.com
  gateways:
  - my-gateway
  http:
  - match:
    - uri: /productpage
    route:
    - destination:
        host: my-productpage
        port:
          number: 9080

DestinationRule

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: my-destinationrule
spec:
  host: my-productpage
  trafficPolicy:
    timeout: 10s
    retry:
      perTryTimeout: 5s

ServiceEntry

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: my-serviceentry
spec:
  hosts:
  - my-external-service.example.com
  ports:
  - number: 80
    name: http
    protocol: HTTP
  location: MESH_EXTERNAL
  resolution: DNS
aibangjuxin commented 8 months ago

name: my-virtualservice 定义了一个 VirtualService 资源的名称,它依赖于以下资源:

依赖关系图:

my-virtualservice (VirtualService)
    ↓
my-gateway (Gateway)
    ↓
my-productpage (Service)
    ↓ (可选)
my-serviceentry (ServiceEntry)

注意: