[istio] wasmPlugins 적용 구조

zzery·2022년 8월 7일

일지(2022~2024)

목록 보기
19/25

istio-agent

At a high level, the Istio agent acts as an intermediate proxy between Istiod and Envoy. This is done at two levels. For distributing workload certificates, Envoy will send SDS requests to the agent, causing the agent to submit a CSR to the configured CA (generally Istiod). For other configuration, Envoy will send ADS requests to the agent, which will be forwarded to the configured discovery server (general Istiod).

xDS

Envoy는 API를 통한 설정이 가능하다.
istio 사용할 때는 실제 설정을 istio Control Plane에서 받아와 사용한다.
즉 Listener, Route, Cluster, Endpoint 등을 동적으로 로드할 수 있다.

이를 위한 API를 Discovery Servicd API 라고 하는데

  • LDS
  • RDS
  • CDS
  • EDS

이 집합들을 xDS 라고 부른다.

그래서.. Service Mesh를 다시 분류하면 이렇게 된다.

  • Control Plane (xDS를 제공함)
  • Data Plane (Envoy + App)

즉 Control Plane은 envoy에서 필요한 xDS API를 적절히 제공하는 역할이다.
(gRPC가 REST보다 더 일반적이라고 한다.)


wasmPlugin이 적용되는 과정...

  1. apply wasmPlugin
  2. istiod -> istio-agent (in istio-proxy) -> RDS? ECDS? 로 로컬 볼륨에 저장

configMap으로 마운트하는게 아니다. (저장되는 위치는 /var/lib/istio/data/###.wasm)

2022-08-07T13:36:25.950592Z    info    ads    Push debounce stable[96] 1 for config WasmPlugin/default/sample-rate-limiting: 100.323515ms since last change, 100.323194ms since last push, full=true
2022-08-07T13:36:25.950766Z    info    ads    XDS: Pushing:2022-08-07T13:36:25Z/61 Services:21 ConnectedEndpoints:4 Version:2022-08-07T13:36:25Z/61
2022-08-07T13:36:25.951050Z    info    ads    LDS: PUSH for node:istio-egressgateway-7767fbfc44-qkrsp.istio-system resources:0 size:0B
2022-08-07T13:36:25.951212Z    info    ads    LDS: PUSH for node:istio-ingressgateway-76df49f94d-gbvjk.istio-system resources:1 size:3.5kB
2022-08-07T13:36:25.952871Z    info    ads    LDS: PUSH for node:sample2-web-pod-69975749b4-r6bjn.default resources:31 size:139.3kB
2022-08-07T13:36:25.952871Z    info    ads    LDS: PUSH for node:sample-web-pod-6f6fd4656b-qx7mx.default resources:31 size:139.3kB
2022-08-07T13:36:25.953033Z    info    ads    ECDS: PUSH for node:sample2-web-pod-69975749b4-r6bjn.default resources:1 size:220B
2022-08-07T13:36:25.953100Z    info    ads    ECDS: PUSH for node:sample-web-pod-6f6fd4656b-qx7mx.default resources:1 size:220B

다만 에러도 있다.재현 순서는

  1. apply wasmPlugin
  2. istio-proxy 에서 wasm 파일 직접 삭제 (이때까진 가능)
  3. delete wasmPlugin
  4. selector 대상으로 wasmPlugin이 적용되지 않음 (아래 로그)

캐싱이 원인인 듯 하다.

warn    
ads    
ADS:ECDS: 
ACK ERROR sample2-web-pod-69975749b4-bnf6r.default-15 
Internal:Invalid path: 
/var/lib/istio/data/2cf37b4603a3d87c7771cd0a33f01bbe9ae07ed0e86dc30fe7e8e7b982dd725f.wasm 

envoy 설정 확인 방법?

나랑 비슷한걸 궁금해 한 사람이 있다.

wasmPlugin은 적용됐는데 envoy 설정 파일에서 찾아볼 수 없다?

It requests it over XDS from the istio-agent component which pulls from the registry

Envoy has the name, it requests the name over XDS. The istio-agent knows
the mapping of name->hash (since it creates the hash)

profile
이 블로그의 모든 글은 수제로 짜여져 있습니다...

0개의 댓글