Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Istio custom resource들이 어떻게 mesh logic으로 변하는가? #3

Open
ByeongHunKim opened this issue Sep 13, 2024 · 6 comments
Assignees
Labels
question Further information is requested Season1 Season1 Study
Milestone

Comments

@ByeongHunKim
Copy link
Owner

ByeongHunKim commented Sep 13, 2024

Question / 질문 내용

How Does Istio Send Configurations to Envoy Sidecars?

istiod가 istio 관련된 custom resources들 ( gateway, virtual Service, Destination Rule ) 들을 감지해서 envoy proxy가 이해할 수 있도록 mesh logic으로 변하게 하는 것으로 이해했는데 정확히 어떻게 변하는 지 제대로 이해는 못하였습니다.

Context / 상황 설명
image

위 영상을 보다가 mesh logic으로 변하는 부분

What I've Tried / 시도한 방법
질문에 대한 답을 찾기 위해 시도해본 방법이 있다면 설명해주세요

우선 이슈를 올려놓고 좀 알아볼 예정입니다.

Resources / 관련 자료
질문과 관련된 문서, 링크, 코드 등이 있다면 여기에 첨부해주세요

https://blog.naver.com/alice_k106/222000680202

https://www.zhaohuabing.com/post/2018-09-25-istio-traffic-management-impl-intro/#virtual-listener

Additional context / 추가 사항
기타 추가적인 정보나 생각이 있다면 여기에 작성해주세요

@ByeongHunKim ByeongHunKim added the question Further information is requested label Sep 13, 2024
@ByeongHunKim ByeongHunKim self-assigned this Sep 13, 2024
@opp-13
Copy link
Collaborator

opp-13 commented Sep 14, 2024

도움이 될진 모르겠지만 관련 링크를 찾아서 공유해드립니다.

https://www.anyflow.net/sw-engineer/istio-internals-by-xds
https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol

@ByeongHunKim
Copy link
Owner Author

ByeongHunKim commented Sep 17, 2024

읽어봤는데도 좀 어렵네요 ㅠㅠ..

@ByeongHunKim ByeongHunKim added this to the Milestone1 milestone Sep 19, 2024
@ByeongHunKim ByeongHunKim added the Season1 Season1 Study label Sep 20, 2024
@ByeongHunKim ByeongHunKim changed the title [Question] istio CR이 어떻게 mesh logic으로 변하는가? [Question] Istio custom resource들이 어떻게 mesh logic으로 변하는가? Sep 23, 2024
@ByeongHunKim
Copy link
Owner Author

ByeongHunKim commented Sep 23, 2024

  1. 링크에서 How Does Istio Send Configurations to Envoy Sidecars? 부분을 보면 이해할 수 있을 것 같다

  2. 성호님이 주신 두번째 링크 - For a detailed introduction to the xDS protocol, such as xDS RPC services and variant methods, as well as the xDS request process

  3. Istio Configuration Distribution Process Diagram

image
  • xDS API는 Istio의 핵심 구성 요소로, Istiod와 Envoy 프록시 간의 통신을 담당
  • 이를 통해 동적 설정 업데이트가 가능하며, 서비스 메시의 실시간 관리를 지원

@ByeongHunKim

This comment was marked as spam.

@ByeongHunKim ByeongHunKim mentioned this issue Oct 2, 2024
@ByeongHunKim
Copy link
Owner Author

ByeongHunKim commented Oct 4, 2024

istio-ingressgateway

ingress gateway에 구성되어있는 istio proxy container 즉, Envoy는 istiod로부터 받은 서비스 엔드포인트 정보를 사용하여 대상 서비스의 실제 파드 IP를 찾을텐데 이 서비스 디스커버리 과정을 자세하게 모름

cluster edge에 존재해서 트래픽을 받는 ingress gw pod도 proxy container 로 이루어져 있기 때문에 함께 동기화 되는 것 같음

k get pod <istio-ingressgateway-pod-name> -n istio-system -o jsonpath='{.spec.containers[*].name}'
# output 
# istio-proxy

xDS API 학습 과정

  • istiod는 xDS(CDS, EDS, LDS, RDS 등) 프로토콜을 통해 Envoy proxy에 설정을 동적으로 전달

  • 링크 의 설명에서는 Envoy를 프록시로서 사용할 때 알아야 하는 4가지 개념(Listener, Route, Cluster, Endpoint)을 설명했고, Envoy는 앞서 언급한 Listener, Route, Cluster, Endpoint 등을 동적으로 로드할 수 있는 Discovery Service API를 사용하고 있는데, 이러한 API를 각각 LDS, RDS, CDS, EDS라고 부르며, Discovery Service API의 집합을 xDS라고 부른다고 한다

  • Wiki에 xDS 학습을 기록해둠


코드 레벨 분석 ( 1.23.2 tag 버전 )

  1. Istio/pilot/pkg/serviceregistry/kube/controller/controller.go
  • 위 코드에 있는 Run 함수는 Istio의 서비스 레지스트리 컨트롤러가 Kubernetes API 서버와 통신하며 서비스와 엔드포인트 변경 사항을 동기화하는 핵심 역할을 함
  1. Istio/pilot/pkg/xds/discovery.go
  • Istio의 xDS(x Discovery Service) 프로토콜 구현의 핵심 부분을 담고 있음

@ByeongHunKim
Copy link
Owner Author

xDS 상세

# 아래 명령어로 특정 파드의 Envoy 프록시 설정 중 라우트 정보를 YAML 형식으로 출력해서 확인할 수 있다
# 사이드카에 동기화된 모든 라우트 정보를 보여주는 것

istioctl proxy-config <clusters|listeners|routes|endpoints|bootstrap|log|secret> <pod-name[.namespace]> -o <short|yaml|json>

@ByeongHunKim ByeongHunKim mentioned this issue Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Season1 Season1 Study
Projects
Status: In Progress
Development

No branches or pull requests

3 participants