Ingress Controller에서 업스트림 헬스체크 구성하기
Ingress Controller에서 업스트림 헬스체크 구성하기 (Upstream Healthchecks)
Kong Ingress Controller를 사용할 때 업스트림 서킷 브레이커와 액티브 헬스체크를 어떻게 설정하는지 단계별로 설명해요 KIC 2.5 LTS와 2.12 LTS에서는 KongIngress 리소스에 healthchecks를 정의한 뒤 Kubernetes Service에 konghq.com/override 어노테이션으로 연결하는 방식을 써요 KIC 3.1부터는 KongIngress가 제거되고 어노테이션과 KongUpstreamPolicy 커스텀 리소스로 같은 구성을 하니까 사용 중인 버전에 맞는 방법을 확인해 보세요
출처: 문서
본문
TL;DR
Kong Ingress Controller로 업스트림 서킷 브레이커와 액티브 헬스체크를 설정하려면 어떻게 해야 하나요?
KIC 2.5 LTS/2.12 LTS에서는 upstream.healthchecks(패시브 및 액티브)가 포함된 KongIngress 리소스를 정의하고, konghq.com/override 어노테이션을 사용해 Kubernetes Service에서 이를 참조하세요. KIC 3.1 이상에서는 KongIngress가 제거되고, 동일한 헬스체크 설정을 다루는 어노테이션과 KongUpstreamPolicy 커스텀 리소스로 대체돼요.
개요
Kubernetes Ingress Controller를 사용하고 Kubernetes Ingress 리소스로 Kong 객체를 정의할 때, 서킷 브레이커와 액티브 헬스체크는 어떻게 정의할 수 있을까요?
단계
KIC 2.5 LTS 및 2.12 LTS 버전인 경우
Kubernetes에서 서킷 브레이커와 액티브 헬스체크를 설정해야 한다면, KongIngress 리소스 객체를 사용하고 정의된 KongIngress를 참조하도록 Kubernetes Service 객체에 어노테이션을 달아서 설정할 수 있어요. 이 작업은 업스트림 파라미터를 변경하는 것이기 때문에, 어노테이션은 Ingress가 아니라 Kubernetes Service에 붙여야 해요.
업스트림 헬스체크 파라미터가 설정된 KongIngress 객체를 사용하도록 Service에 어노테이션을 달고 나면, Kong이 업스트림 객체를 그에 맞게 업데이트하고, 필요하다면 패시브 헬스체크(서킷 브레이커)와 액티브 헬스체크를 제공해요.
예를 들어 다음과 같은 KongIngress를 정의할 수 있어요:
apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
name: sample-kong-ingress
upstream:
hash_on: header
hash_on_header: x-lb
hash_fallback: ip
algorithm: consistent-hashing
healthchecks:
passive:
healthy:
successes: 1
unhealthy:
http_failures: 5
tcp_failures: 5
timeouts: 3
active:
healthy:
interval: 10
successes: 1
unhealthy:
interval: 10
http_failures: 5
tcp_failures: 5
timeouts: 3
그다음, 업스트림이 그에 맞게 설정되도록 Kubernetes Service를 konghq.com/override로 어노테이션해야 해요:
annotations:
konghq.com/override: sample-kong-ingress
Gateway Upstream 헬스체크 문서는 아래 관련 리소스에서 확인할 수 있어요.
KIC 3.1 이상 버전인 경우
Kubernetes Ingress Controller 3.1 이상에서는 KongIngress가 제거될 예정이며, 헬스체크를 포함한 대부분의 경우 어노테이션으로 대체돼요. 아래 어노테이션 및 커스텀 리소스 참조를 확인하세요.
관련 리소스
더 알아보기 (Learn more)
- Gateway에서 업스트림 헬스체크와 서킷 브레이커가 실제로 어떻게 동작하는지 정리된 기본 문서예요 — Gateway Upstream healthchecks documentation
- KIC 3.1 이상에서 KongIngress 대신 업스트림 설정에 사용하는 어노테이션 레퍼런스예요 — KongIngress upstream-policy annotation reference (KIC 3.1+)
- KIC 3.1 이상에서 헬스체크 구성을 담당하는 커스텀 리소스의 레퍼런스예요 — KongUpstreamPolicy custom resource reference (KIC 3.1+)