Kubernetes - Ingress

choko's avatar
Jun 29, 2024
Kubernetes - Ingress
 
  • Ingress를 통해 도메인을 이용하여 서로 다른 서비스에 접근하는 방법을 알아보자.
 
  • backend, frontend 컨테이너가 따로 있고, 서비스도 따로 있으면 각각 다른 포트로 접속해야 한다.
    • 그럴 수 없으니, Ingress로 통합해서 한번에 외부에서 접속하자
  • ex
apiVersion: networking.k8s.io/v1 kind: Ingress ... - path: /api/blochcian # 라우팅 pathType: ImplementationSpecific backend: service: name: bc-backend # 서비스 이름 할당 port: number: 8080 - path: / pathType: ImplementationSpecific backend: service: name: frontend port: number: 80
 
notion image
 
 
  • 쿠버네티스에서 HTTP(S)기반의 L7 로드밸런싱 기능을 제공하는 컴포넌트를 Ingress라고 한다.
  • 개념을 도식화 해보면 아래와 같은데, Ingress 가 서비스 앞에서 L7 로드밸런서 역할을 하고, URL에 따라서 라우팅을 하게 된다.
notion image
 
 
 

Ingress 생성 흐름

 
notion image
  1. Ingress Controller는 Ingress 변화를 체크
  1. Ingress Controller는 변경된 내용을 Nginx에 설정하고 프로세스 재시작
→ YAML로 만든 Ingress 설정을 단순히 nginx 설정으로 바꿔줌
→Ingress는 도메인, 경로만 연동하는 것이 아니라 요청 timeout, 요청 max size 등 다양한 프록시 서버 설정을 할 수 있다.
 
Share article

Tom의 TIL 정리방