본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Fallback Configuration

원문 보기 위키 갱신

Fallback Configuration (폴백 구성)

Fallback Configuration은 Kong Ingress Controller 3.2.0에 도입된 기능으로, 설정 오류가 발생해도 다른 부분의 업데이트는 계속 진행할 수 있도록 도와줘요. 멀티 팀 환경에서 특히 유용하며, 문제가 있는 객체를 제외하거나 마지막 유효 설정으로 대체하여 중단 없는 운영을 지원해요. 이 기능을 사용하려면 컨트롤러의 Feature Gates에서 활성화해야 해요.

출처: 문서

본문

Kong Ingress Controller 3.2.0에서 Fallback Configuration 기능이 도입되었어요. 이 기능은 설정의 개별 부분과 관련된 문제를 격리하여 나머지 부분에 대한 업데이트가 중단 없이 진행되도록 설계되었어요. 여러 팀이 사용하는 환경에서 Kong Ingress Controller를 사용하는 경우, fallback configuration 메커니즘은 한 팀의 설정이 손상되었을 때 잠금 상황을 방지하는 데 도움이 돼요.

참고: Fallback Configuration은 옵트인 기능이에요. 컨트롤러의 feature gates 설정에서 FallbackConfiguration=true로 설정하여 활성화해야 해요. 설정 방법은 Feature Gates를 참조하세요.

Fallback Configuration 작동 방식

Kong Ingress Controller는 Kubernetes API에서 가져온 Kubernetes 객체를 변환하고, 변환 결과를 Kong Gateway의 Admin API를 통해 Kong Gateway 인스턴스로 전송해요. 하지만 이 과정의 여러 단계에서 문제가 발생할 수 있어요:

  1. Admission Webhook: 개별 Kubernetes 객체를 스키마 및 기본 규칙에 대해 검증해요.
  2. Translation Process: 객체 간 검증 오류와 같은 문제를 감지해요.
  3. Kong Gateway Response: Kong Gateway가 설정을 거부하고 특정 객체와 관련된 오류를 반환해요.

Fallback Configuration은 3단계에서 문제가 감지되면 트리거되며 다음과 같은 이점을 제공해요:

  • 영향을 받지 않은 객체는 설정 오류가 있어도 업데이트할 수 있어요.
  • 사용자 개입 없이 Kong Gateway가 수락할 fallback configuration을 자동으로 빌드해요. 다음 중 하나의 방식으로 수행해요:
    • 손상된 객체와 그 종속 객체를 제외해요.
    • CONTROLLER_USE_LAST_VALID_CONFIG_FOR_FALLBACK 환경 변수가 true로 설정된 경우, 마지막 유효한 Kubernetes 객체의 인메모리 캐시를 사용하여 손상된 객체와 그 종속 객체를 백필해요.
  • 사용자가 진단 엔드포인트를 사용하여 설정에서 제외되거나 백필된 객체를 검사하고 식별할 수 있어요.

다음 표는 설정에 따른 Fallback Configuration 기능의 동작을 요약해요:

false

CONTROLLER_USE_LAST_VALID_CONFIG_FOR_FALLBACK 값: 해당 없음 동작: 마지막 유효한 설정이 전체적으로 복구에 사용돼요 (저장된 경우).

true

CONTROLLER_USE_LAST_VALID_CONFIG_FOR_FALLBACK 값: false 동작: Fallback Configuration이 트리거되고, 손상된 객체와 그 종속 객체가 제외돼요.

true

CONTROLLER_USE_LAST_VALID_CONFIG_FOR_FALLBACK 값: true 동작: Fallback Configuration이 트리거되고, 손상된 객체와 그 종속 객체가 제외되며 마지막 유효한 버전으로 백필돼요 (저장된 경우).

아래 다이어그램은 Fallback Configuration 기능이 어떻게 작동하는지 자세히 보여줘요:

 
flowchart TD
classDef sub opacity:0
classDef note stroke:#e1bb86,fill:#fdf3d8
classDef externalCall fill:#9e8ebf,stroke:none,color:#ffffff
classDef decision fill:#a6b4c8

    A([Update loop triggered]) --> B[Generate Kubernetes objects' store snapshot to be passed to the Translator]
    B --> C[Translator: generate Kong configuration based on the generated snapshot]
    C --> D(Configure Kong Gateways using generated declarative configuration)
    D --> E{Configuration rejected?}
    E --> |No| G[Store the Kubernetes objects' snapshot to be used as the last valid state]
    E --> |Yes| F[Build a dependency graph of Kubernetes objects - using the snapshot]
    G --> H[Store the declarative configuration to be used as the last valid configuration]
    H --> Z([End of the loop])
    F --> I[Exclude an object along with all its dependants from the fallback Kubernetes objects snapshot]
    I --> J[Add a previous valid version of the object along with its dependants' previous versions to the fallback snapshot]
    J --> K[Translator: generate Kong configuration based on the fallback snapshot]
    K --> L(Configure Kong Gateways using generated fallback declarative configuration)
    L --> M{Fallback
    configuration
    rejected?}
    M --> |Yes| N{Was the last valid configuration preserved?}
    N --> |Yes| O(Configure Kong Gateways using the last valid declarative configuration)
    O --> Z
    N --> |No| Z
    M --> |No| P[Store the fallback Kubernetes objects' snapshot to be used as the last valid state]
    P --> R[Store the fallback declarative configuration to be used as the last valid configuration]
    R --> Z

    subgraph subI [" "]
        I
        noteI[For every invalid object reported by the Gateway]
    end

    subgraph subJ [" "]
        J
        noteJ[Given there was a last valid Kubernetes objects' store snapshot preserved and the object is present]
    end

    class subI,subJ sub
    class noteI,noteJ note
    class D,L,O externalCall
    class E,M,N decision

  

Fallback Configuration 프로세스 검사

Kong Ingress Controller가 fallback configuration을 성공적으로 적용할 때마다 FallbackKongConfigurationSucceeded 이유로 Kubernetes Event를 발생시켜요. 또한 fallback configuration이 Kong Gateway에 의해 거부되면 FallbackKongConfigurationApplyFailed 이유로 Event를 발생시켜요. 이러한 이벤트를 모니터링하여 fallback configuration 프로세스를 추적할 수 있어요.

다음을 실행하여 Event가 발생했는지 확인할 수 있어요:

kubectl get events -A --field-selector='reason=FallbackKongConfigurationSucceeded'

결과는 다음과 같아요:

NAMESPACE   LAST SEEN   TYPE     REASON                               OBJECT                                 MESSAGE
kong        4m26s       Normal   FallbackKongConfigurationSucceeded   pod/kong-controller-7f4fd47bb7-zdktb   successfully applied fallback Kong configuration to https://192.168.194.11:8444

Fallback Configuration 메커니즘을 모니터링하는 또 다른 방법은 Prometheus 메트릭을 사용하는 거예요. 자세한 내용은 Prometheus Metrics를 참조하세요.

관련 자료

더 알아보기 (Learn more)