Twenty-nine chapters analyze with you easily complete explosion Istio - virtual service Brief

Series:


Index List: nine analyze with you easily complete explosion istio Service Grid Tutorial Series

table of Contents

1 Introduction

2 offer

3 virtual service briefly

4 virtual service Sample

    4.1 jiuxi-busybox.yaml

    4.2 jiuxin-deployment.yaml

    4.3 jiuxin-svc.yaml

    4.4 jiuxi-vs.yaml

5 Istio injection

6 Login client validation rules take effect

7 summary


1 Introduction

        If you have any questions about the blog, please let me know.1.png


2 offer

        You can search from the station b "Nine Analysis" to get a free, more vivid video material:clipboard2.png


3 virtual service briefly

        In the previous chapters we have already talked about the concepts and theories of the virtual service. Here to do a repeat, virtual service is a virtual service, it is not really k8s service, first of all you can not be kubectl get svc way to find it, and secondly when the service call would not call it directly, it's like behind the service of k8s as a woman, tightly holding k8s service of her second child, make it specific target obediently follow his own will route traffic to the request within the grid.

The following are frequently troubled by the problem for beginners, 11 to do the following answer.

One problem: Virtual service relationship with k8s service is what it is. You are strong binding it?

Answer: It is not strong binding. virtual service can help k8s service to do more fine-grained control over the routing, but does not have to Round-Robin policy.


Second problem: Virtual service must keep Istio traffic management of other resources, such as destination rule, gateway, service entries tied to use it?

Answer: no. Virtual service itself can have an effect. Of course, it can also construct a more flexible, rich routing rules together with the gateway, or with destination rule.


Question three: routing rules (Routing rules) with the Destination rule is the same thing?

Answer: no. Routing rules are a logical concept, and Destination rule is a resource of Istio. Destination rule you can be seen as a subset of the Routing rules.


Question four: Virtaul service of the hosts field to fill what?

Answer: hosts field value is the address used when the client sends a request to the service. This address may be an IP address, DNS name, and may be k8s service name (or address complete address short term, such as web-svc.default.cluster.local), if a short name, the requirements can be implicitly or explicitly parse fully qualified domain name (FQDN). Of course, you can also use wildcards (*) prefix to create a routing rule for all matching service. Virtual Host service is actually not necessarily part of Istio service registry, they can only be addressable virtual destination only. In this way, it can be modeled as a virtual host with no traffic routing entries within the grid.


4 virtual service Sample

        The following describes a virtual service acting independently examples, the present embodiment requires the following resources:

# Call the client services

jiuxi-busybox.yaml

# Two web servers: tomcat and httpd. Two micro analog service, Istio needs to be injected, injecting into the service after the service grid

jiuxin-deployment.yaml


# Define three services: httpd-svc point httpd, tomcat-svc point tomcat. web-svc while pointing httpd and tomcat

jiuxin-svc.yaml


# Istio virtual service: the definition of virtual services, the role of virtual service on the web-svc service, and set up a simple routing rules (Routing rule, rather than the Destination rule)

jiuxi-vs.yaml

        The following introduced one by one each resource file details.

4.1 jiuxi-busybox.yaml

        Code is shown below:clipboard3.png

4.2 jiuxin-deployment.yaml

        Screenshot code is as follows:clipboard4.png

4.3 jiuxin-svc.yaml

        Screenshot code is as follows:clipboard5.png

4.4 jiuxi-vs.yaml

        Screenshot code is as follows:clipboard6.png


5 Istio injection

        The client and perform a manual deployment for injection:

istioctl the object -f jiuxi-deploy.yaml jiuxi-busybox.yaml | kubectl apply -f -

istioctl the object -f jiuxi-busybox.yaml | kubectl apply -f -


6 Login client validation rules take effect

        Log on to busybox, then the following commands can see the rules take effect:

-q -O wget - HTTP: // Web-svc: 8080 # Web-svc is k8s service. The letter O, not a number 0

wget -q -O - http: // IP: 8080 # IP is a web-svc of ClusterIP.


7 summary

        Since you easily finished with nine analysis burst of virtaul service Istio traffic management.

Guess you like

Origin blog.51cto.com/14625168/2485899