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

Blog    
Blog    

Recommend

Five network management trends for 2022

With the advent of the Internet era, people need ...

Network Lifecycle Management Guide

The network lifecycle management process helps ne...

How to decide if Wi-Fi 6 is right for you?

There’s a lot of hype surrounding the next Wi-Fi ...

What are the categories of 800G optical modules?

800G optical modules have entered mass production...

Aruba expands SD-WAN services to Alibaba Cloud

Aruba, a Hewlett Packard Enterprise company, anno...

IPv6 is coming, what should we do with SDN?

IPv6 has been called for so many years, and final...

For the first time, such a clear and unconventional explanation of K8S network

[51CTO.com original article] K8S network design a...

Education takes off with 5G smart technology

Education is the foundation of a country, and 5G ...