Istio Brief

What is istio

Istio provides a simple way to build a network for the service is deployed, the network with load balancing, inter-service certification, monitoring and other functions, without having to make any changes to the code of service.

  • istio suitable for container or virtual machine environment (especially k8s), is compatible with heterogeneous architectures.
  • istio use sidecar (sidecar mode) network proxy service does not need to do any business code itself changes.
  • Automatic load balancing HTTP, gRPC, WebSocket and TCP traffic.
  • istio by rich routing rules, Retry, failover and fault injection, can be fine-grained control over the flow behavior; support access control, rate restrictions and quotas.
  • istio automatic metrics for access to cluster the inlet and outlet of all traffic, logging and tracing.

Deployment Examples

Examples of the official website of little issues in my environment, directly deploy application review will be reported com.ibm.ws.kernel.boot.LaunchExceptionerror, it failed to start. Did not find the specific reasons, and my guess is websphere environment a little conflict (kubeadm many online directly from the cluster seems to have little problem)? I will rewrite it became a spring boot project, the code is visible GitHub .

First deployment of a short book review site architecture shown.

 

Architecture schematic

Micro-site includes four services:

  1. productpage: This service will call details and reviews two micro-services, used to generate the page.
  2. details: This micro service contains information books.
  3. reviews: This service includes micro comments related books. It also calls the ratings Micro service.
  4. ratings: ratings service contains micro-rating information from the evaluation of the composition of books.

reviews Micro Services has three versions:

  1. v1 version does not call the ratings service.
  2. v2 version calls ratings service, and use 1-5 black star icon to display ratings information.
  3. v3 version calls ratings service, and use 1-5 red star icon to display ratings information.

Access effect is as follows:

 

webpuploading.4e448015.gifDump failed to re-upload canceled

Access effect

 

Since Bookinfo example deployed three versions reviews micro-services, many times when we access the application, you can sometimes see the output consists of a star rating, and sometimes not.

Intelligent Routing

It can be fine-grained control of traffic routing rules.

1. Custom routing

First, all traffic will be imported v1 versions reviews

Use the following configuration, and submitted to the k8s.

 

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: reviews
spec:
  hosts:
  - reviews
  http:
  - route:
    - destination:
        host: reviews
        subset: v1

Wait a few seconds to see the changes:

 

Access the effect of submitting Configuration

Now you can see all the traffic go v1 version of the review.

Distribute traffic based on header content

istio can distribute traffic based on content, where we allow ordinary users to access all the v1 version, while special user (jason) access v2 version.
Use the following configuration, and submitted to the k8s.

 

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: reviews
spec:
  hosts:
    - reviews
  http:
  - match:
    - headers:
        end-user:
          exact: jason
    route:
    - destination:
        host: reviews
        subset: v2
  - route:
    - destination:
        host: reviews
        subset: v1

Ordinary users can see still access v1 version of the review.

 

Ordinary users can still access the v1 version of the review

Jason identity and login to access v2 version will review (black five-pointed star).

 

jason access v2 edition review

In addition istio delay can be injected, disconnection failure between service. You can do to scale migration needs.

monitor

In Istio, you can let Mixer automatically generate all the grid and traffic reports new indicators, and new log stream. Below book-info application as an example, showing distributed track.

Prometheus

Used as an indicator collection with the query.

 

Prometheus index query

Prometheus indicators collection job

Distributed Track

Although Istio Span agent can automatically send information, but still need some assistance to unify the whole tracking process. The application should track the spread of self-related HTTP Header, so that when the agent sends Span information, to the right of the track with a unified process.

productpage Service Access Overview

Call chain track

Service topology

grafana

Use grafana of istio itself and the service grid monitoring.

Services market

client workload

service workload

 

Published 28 original articles · won praise 3 · Views 5287

Guess you like

Origin blog.csdn.net/u012632105/article/details/104761831