Let's talk about viewing ServiceEntry injection information in Envoy

Let's talk about viewing ServiceEntry injection information in Envoy

  [[431019]]

introduction

Istio provides ServiceEntry configuration to include services outside the mesh into mesh management. Third-party registration centers such as Zookeeper and Nacos can be included in the Istio mesh and managed by Istio through ServiceEntry. How to inject these and what is the process? The following example shows the entire process.

1. How ServiceEntry injection works

Flowchart of ServiceEntry injection

Note: The injection process is as follows

@1 Inject ServiceEntry into kube-apiserver

@2 Istiod monitors ServiceEntry configuration changes through kubeConfigController

@3 Istiod encapsulates ServiceEntry into PushRequest and sends it to XDSServer

@4 XDSServer converts to xDS format and sends it to Envoy

2. View ServiceEntry in Envoy

1. Organize ServiceEntry configuration

Configure the Baidu domain name through ServiceEntry and make it part of the grid service serviceentry.yaml

  1. ---
  2. apiVersion: networking.istio.io/v1alpha3
  3. kind: ServiceEntry
  4. metadata:
  5. name : baidu-external
  6. spec:
  7. hosts:
  8. - www.baidu.com
  9. ports:
  10. - number: 80
  11. name : HTTP
  12. protocol: HTTP
  13. resolution: DNS
  14. location: MESH_INTERNAL

2. Deploy ServiceEntry configuration

Deploy to the Kubernetes api server using the following command

  1. kubectl apply -f serviceentry.yaml -n default
  2. serviceentry.networking.istio.io/baidu-external created

3. View ServiceEntry information in Istio

Log in to the istiod container

  1. kubectl -n istio-system exec -it istiod-5c4b9cb6b5-6n68m -- /bin/bash

Check with the registryz command and you will see that it has been injected into istio.

  1. istio-proxy@istiod-5c4b9cb6b5-6n68m:/$ curl http://127.0.0.1:15014/debug/registryz
  2. [
  3. {
  4. "Attributes" : {
  5. "ServiceRegistry" : "External" ,
  6. "Name" : "www.baidu.com" ,
  7. "Namespace" : "default" ,
  8. "Labels" : null ,
  9. "UID" : "" ,
  10. "ExportTo" : null ,
  11. "LabelSelectors" : null ,
  12. "ClusterExternalAddresses" : null ,
  13. "ClusterExternalPorts" : null
  14. },
  15. "ports" : [
  16. {
  17. "name" : "HTTP" ,
  18. "port" : 80,
  19. "protocol" : "HTTP"
  20. }
  21. ],
  22. "creationTime" : "2021-10-14T03:01:24Z" ,
  23. "hostname" : "www.baidu.com" ,
  24. "address" : "0.0.0.0" ,
  25. "autoAllocatedAddress" : "240.240.0.5" ,
  26. "Mutex" : {},
  27. "Resolution" : 1,
  28. "MeshExternal" : false
  29. },
  30. // ...
  31. ]

4. View xDS information in Envoy

  1. istioctl proxy-config route productpage-v1-6b746f74dc-2c55l -n default -o json
  2. [
  3. //...
  4. {
  5. "name" : "www.baidu.com:80" ,
  6. "domains" : [
  7. "www.baidu.com" ,
  8. "www.baidu.com:80"
  9. ],
  10. "routes" : [
  11. {
  12. "name" : "default" ,
  13. "match" : {
  14. "prefix" : "/"
  15. },
  16. "route" : {
  17. "cluster" : "outbound|80||www.baidu.com" ,
  18. "timeout" : "0s" ,
  19. "retryPolicy" : {
  20. "retryOn" : "connect-failure,refused-stream,unavailable,cancelled,retriable-status-codes" ,
  21. "numRetries" : 2,
  22. "retryHostPredicate" : [
  23. {
  24. "name" : "envoy.retry_host_predicates.previous_hosts"
  25. }
  26. ],
  27. "hostSelectionRetryMaxAttempts" : "5" ,
  28. "retriableStatusCodes" : [
  29. 503
  30. ]
  31. },
  32. "maxStreamDuration" : {
  33. "maxStreamDuration" : "0s" ,
  34. "grpcTimeoutHeaderMax" : "0s"
  35. }
  36. },
  37. "decorator" : {
  38. "operation" : "www.baidu.com:80/*"
  39. }
  40. }
  41. ],
  42. "includeRequestAttemptCount" : true
  43. }
  44. // ...
  45. ]

Summary: Through the above command tracing, the ServiceEntry example is sent to the data plane Envoy.

<<:  Four experiments to thoroughly understand the disconnection of TCP connections

>>:  6G! China Mobile and Nokia renew strategic cooperation agreement

Recommend

CloudCone: $14.11/year KVM-1GB/20GB/5TB/Los Angeles data center

CloudCone also launched promotions during the Dou...

How is the operator's name displayed on your phone?

[[379606]] This article is reprinted from the WeC...

Summary information: Journey Cloud/Eurasia Cloud/PIGYun/Wuluo Cloud/Jtti

Next, I will share some product and promotion inf...

Why MAC addresses do not need to be globally unique

MAC address (Media access control address) is a u...

Edgevirt: $9/half year-1GB/25GB/5TB/10Gbps bandwidth/Seattle data center

Edgevirt is a foreign hosting company established...

What types of single-mode optical fiber are used?

What is single mode fiber? In fiber optic technol...

Record an incident where a network request connection timed out

[[338985]] This article is reprinted from the WeC...

Network programming - starting from establishing a TCP connection

[[388071]] Preface Network programming is somethi...

How to choose NB-IoT, Cat.1, and Cat.M for IoT device communication?

1. What is NB-IoT NB-IoT (Narrow Band Internet of...