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

Gateway API HTTPRoute로 UI 노출하기

원문 보기 위키 갱신

Gateway API HTTPRoute로 UI 노출하기 (Create an HTTPRoute with Gateway API)

kubectl이나 Helm으로 Longhorn을 설치했다면, Longhorn UI를 외부 트래픽에 노출하기 위해 Ingress 대신 최신 방식인 Gateway API HTTPRoute를 사용할 수 있어요. Gateway API CRDs 설치, Helm values 설정, 기본 설치, basic auth 연동, 검증 절차까지 다뤄요.

출처: 문서

본문

kubectl이나 Helm으로 Kubernetes 클러스터에 Longhorn을 설치했다면, Longhorn UI를 외부 트래픽에 노출하기 위해 Ingress 대신 최신 방식인 Gateway API HTTPRoute를 사용할 수 있어요.

Gateway API는 Ingress의 후속 격으로, 더 풍부한 라우팅 기능과 구현체들 사이에서 표준화된 접근 방식을 제공해요.

사전 조건 (Prerequisites)

kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.0/standard-install.yaml
  • 클러스터에서 동작 중인 Gateway 컨트롤러(예: Istio, Envoy Gateway, Cilium, NGINX Gateway Fabric, Traefik 등)
  • 배포·구성된 Gateway 리소스가 최소 1개

Helm Values 설정 (Helm Values Configuration)

다음 Helm values들이 HTTPRoute 생성을 제어해요:

Key Type Default Description
httproute.enabled bool false Longhorn UI의 HTTPRoute 생성을 활성화해요.
httproute.parentRefs list [] 어떤 Gateway(들)가 이 라우트를 처리할지 지정하는 Gateway 참조 목록이에요.
httproute.hostnames list [] HTTPRoute에 바인딩되는 호스트네임 목록이에요.
httproute.filters list [] Longhorn UI의 HTTPRoute 규칙에 붙일 Gateway API 필터 목록이에요.
httproute.path string "/" Longhorn UI에 접근할 때 쓰는 라우팅 경로예요.
httproute.pathType string "PathPrefix" 경로 매치 타입이에요. 유효한 옵션은 "Exact", "PathPrefix", "RegularExpression"이에요.
httproute.annotations object {} HTTPRoute 리소스에 적용할 키-값 어노테이션이에요.

기본 설치 (Basic Installation)

HTTPRoute를 활성화해서 Longhorn을 설치해요:

helm install longhorn longhorn/longhorn \
  --namespace longhorn-system \
  --create-namespace \
  --set "httproute.enabled=true" \
  --set "httproute.parentRefs[0].name=my-gateway" \
  --set "httproute.parentRefs[0].namespace=default" \
  --set "httproute.hostnames[0]=longhorn.example.com"

고급 설정 (Advanced Configuration)

더 복잡한 구성이라면 values 파일을 만들어요:

httproute:
  enabled: true
  parentRefs:
    - name: primary-gateway
      namespace: gateway-system
    - name: secondary-gateway
      namespace: gateway-system
      sectionName: https  # Target specific listener
  hostnames:
    - longhorn.example.com
    - longhorn.example.org
  path: /longhorn
  pathType: PathPrefix
  annotations:
    custom-annotation: "value"

values 파일로 설치해요:

helm install longhorn longhorn/longhorn \
  --namespace longhorn-system \
  --create-namespace \
  --values values.yaml

basic auth 연동으로 Longhorn UI 보안 접근 구성하기 (Secure access to Longhorn UI with basic auth integration)

Longhorn UI에 인증된 접근을 켜려면, HTTPRoute의 filters 필드를 통해 기존 인증 프록시나 미들웨어 리소스를 참조해요. 다음 예제는 basic authentication을 제공하는 Traefik Middleware 리소스가 이미 구성되어 있다고 가정해요:

httproute:
  enabled: true
  parentRefs:
    - name: primary-gateway
      namespace: gateway-system
    - name: secondary-gateway
      namespace: gateway-system
      sectionName: https  # Target specific listener
  hostnames:
    - longhorn.example.com
    - longhorn.example.org
  filters:
    - type: ExtensionRef
      extensionRef:
        group: traefik.io
        kind: Middleware
        name: oauth-forwardauth
  path: /longhorn
  pathType: PathPrefix
  annotations:
    custom-annotation: "value"

참고 (Note): filters는 표준 HTTPRoute에는 선택 사항이에요. 참조되는 리소스는 별도로 구성되어 있어야 하고, HTTPRoute가 만들어지기 전에 존재해야 해요.

같은 values 파일로 Longhorn을 설치해요:

helm install longhorn longhorn/longhorn \
  --namespace longhorn-system \
  --create-namespace \
  --values values.yaml

검증 (Verification)

  • HTTPRoute가 생성되었는지 확인:
kubectl get httproute -n longhorn-system
  • HTTPRoute 상세 확인:
kubectl describe httproute longhorn-httproute -n longhorn-system
  • 라우트가 Gateway에 수용(accepted)되었는지 확인:
kubectl get httproute longhorn-httproute -n longhorn-system -o jsonpath='{.status.parents[*].conditions}'

출력에 Accepted: True와 ResolvedRefs: True가 표시되어야 해요.

  • Gateway의 외부 IP나 호스트네임을 통해 Longhorn UI에 접속해요.

참고 자료 (References)

더 알아보기 (Learn more)