Traffic management API configurations.

Intro

Resources

Gateway

Sample

sample/traffic-management/gateway.yaml

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

After creating the Gateway, you also need to create a VirtualService to bind to it.

Fields

The interpretation of the fields in the sample.

VirtualService

Sample

sample/resources/virtualservice.yaml

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookinfo
spec:
  hosts:
  - "*"
  gateways:
  - bookinfo-gateway
  http:
  - match:
    - uri:
        exact: /productpage
    - uri:
        prefix: /static
    - uri:
        exact: /login
    - uri:
        exact: /logout
    - uri:
        prefix: /api/v1/products
    route:
    - destination:
        host: productpage
        port:
          number: 9080
        subset: v1

This VirtualService is bound to the Gateway above. VirtualService and DestinationRule are the basic configuration that affect the traffic routing.

Fileds

The interpretation of the fields in the sample.

Visit istio.io for more details.

DestinationRule

Sample

sample/resources/destinationrule.yaml

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: productpage
spec:
  host: productpage.bookinfo.svc.cluster.local
  trafficPolicy:
    loadBalancer:
      simple: LEAST_CONN
  subsets:
  - name: v1
    labels:
      version: v1

Fileds

The interpretation of the fields in the sample.

Visit istio.io for more details.

WorkloadEntry

Sample

sample/resources/workloadentry.yaml

apiVersion: networking.istio.io/v1alpha3
kind: WorkloadEntry
metadata:
  name: details-we
spec:
  serviceAccount: details-legacy
  address: 2.2.2.2
  labels:
    app: details-legacy
    instance-id: vm1

Fields

The interpretation of the fields in the sample.

WorkloadGroup

Samples

sample/resources/workloadgroup.yaml

apiVersion: networking.istio.io/v1alpha3
kind: WorkloadGroup
metadata:
  name: details-wg
spec:
  metadata:
    labels:
      app.kubernetes.io/name: details
  template:
    ports:
      http: 8080
    serviceAccount: default
  probe:
    initialDelaySeconds: 5
    timeoutSeconds: 3
    periodSeconds: 4
    successThreshold: 3
    failureThreshold: 3

Fields

The interpretation of the fields in the sample.

Visit istio.io for more details.