自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

聊聊 Envoy 中查看 ServiceEntry 注入信息

網絡 通信技術
在Istio中提供了ServiceEntry的配置,將網格外的服務納入網格管理。將第三方注冊中心zookeeper、nacos等納入Istio網格可以通過ServiceEntry納入Istio的管理。這些如何注入的,流程是怎么樣,下面通過示例將整個流程竄起來。

  [[431019]]

引言

在Istio中提供了ServiceEntry的配置,將網格外的服務納入網格管理。將第三方注冊中心zookeeper、nacos等納入Istio網格可以通過ServiceEntry納入Istio的管理。這些如何注入的,流程是怎么樣,下面通過示例將整個流程竄起來。

一、ServiceEntry注入工作原理

ServiceEntry注入的流程圖

備注:注入流程如下

@1 將ServiceEntry注入到kube-apiserver中

@2 Istiod中通過kubeConfigController監(jiān)聽ServiceEntry配置的變化

@3 Istiod將ServiceEntry封裝成PushRequest發(fā)送給XDSServer

@4 XDSServer轉換為xDS格式下發(fā)給Envoy

二、Envoy中查看ServiceEntry

1.組織ServiceEntry配置

通過ServiceEntry配置baidu域名,將其作為網格服務的一部分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.部署ServiceEntry配置

通過下面命令部署到Kubernetes api server中

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

3.Istio中查看ServiceEntry信息

登陸istiod容器

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

通過registryz命令查看,已經注入到istio中。

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

4.在Envoy查看xDS信息

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

小結:通過上面的命令追蹤,ServiceEntry的示例下發(fā)到了數據面Envoy中。

責任編輯:武曉燕 來源: 瓜農老梁
相關推薦

2021-11-29 10:24:56

WasmEnvoy 負載均衡

2021-03-17 09:35:51

MySQL數據庫explain

2015-12-21 13:34:31

LinuxGPU顯卡硬件

2010-11-01 17:22:44

2019-07-23 15:04:54

JavaScript調用棧事件循環(huán)

2023-10-07 11:04:58

WPF數據UI

2023-11-09 11:56:28

MySQL死鎖

2021-08-31 07:54:24

SQLDblink查詢

2024-04-26 00:00:00

Rust檢查器代碼

2024-05-22 08:00:00

2021-11-17 08:11:35

MySQL

2014-08-11 10:05:33

CentOS

2020-05-06 22:07:53

UbuntuLinux操作系統(tǒng)

2022-12-29 08:54:53

依賴注入JavaScript

2021-10-18 10:54:46

xDSEnvoy代理

2022-05-10 07:46:08

Envoy網絡通訊

2010-09-06 11:57:33

sql server語句

2022-04-02 08:14:02

JavaThreadLoca數據

2023-08-29 09:46:12

SQLCTE遞歸

2021-12-11 19:00:54

Java中斷機制
點贊
收藏

51CTO技術棧公眾號