Gateway API Support
- 개선된 리소스 모델
- API는 GatewayClass, Gateway 및 Route(HTTPRoute, TCPRoute 등)와 같은 새로운 사용자 정의 리소스를 도입하여 라우팅 규칙을 정의하는 보다 세부적이고 표현력 있는 방법을 제공한다.
- 프로토콜 독립적
- 주로 HTTP용으로 설계된 Ingress와 달리 Gateway API는 TCP, UDP, TLS를 포함한 여러 프로토콜을 지원한다.
- 강화된 보안
- TLS 구성 및 보다 세부적인 액세스 제어에 대한 기본 제공 지원
- 교차 네임스페이스 지원
- 서로 다른 네임스페이스의 서비스로 트래픽을 라우팅하여 보다 유연한 아키텍처 구축 기능을 제공한다.
- 확장성
- API는 사용자 정의 및 정책으로 쉽게 확장할 수 있도록 설계되었다.
- 역할 지향
- 클러스터 운영자, 애플리케이션 개발자, 보안 팀 간의 우려를 명확하게 분리한다.
GPT한테 한눈에 알아보기 쉽게 비교표를 정리해달라고 했다.
Ingress vs Gateway API vs Cilium Gateway API
| 구분 | Ingress | Gateway API | Cilium Gateway API |
| 개념 | Kubernetes에서 가장 초창기부터 제공한 L7 트래픽 진입점 리소스 | Ingress의 한계를 극복하기 위해 SIG-Network 가 표준화 중인 차세대 API | Gateway API 스펙을 Cilium(eBPF+Envoy)으로 구현한 구현체 |
| 리소스 모델 | Ingress 단일 리소스 중심 | Gateway, GatewayClass, HTTPRoute, TCPRoute, UDPRoute 등 세분화된 리소스 |
Gateway API 리소스를 그대로 사용 Cilium이 이를 컨트롤 |
| 표현력 | 제한적 (Host, Path 기반 라우팅 위주) |
풍부함 (다중 리스너, 다양한 라우팅 규칙, TCP/UDP 지원) |
동일 (Gateway API 기능 지원) |
| 확장성 | CRD 확장이 어려움 -> Controller 마다 Annotation 남발 |
CRD 기반이라 확장성이 높고 Controller 간 공통 API 사용 가능 |
Cilium CRD와 결합 eBPF/Envoy 특화 기능 제공 |
| 컨트롤러 종속성 | Nginx, Traefik, HAProxy 등 Controller 별 동작 차이가 큼 |
표준화된 스펙으로 Controller 구현체 선택 가능 |
Cilium이 Contoller 역할 (Envoy 내장) |
| L4 지원 | 불가능 (HTTP/HTTPS 만) | TCP/UDPRoute 리소스로 가능 | 가능 (Cilium의 L4 datapath와 연계) |
| Client IP visibility | 보통 X-Forwarded-For 의존 | 스펙 차원에서는 보장 안 함 구현체 의존 |
Cilium의 Direct Routing/BGP 모드 활용 시 원본 Client IP 유지 가능 |
| 정책 연계 | 네트워크 정책과 별개 | L4/L7 정책과 연계 가능 (추상화가 더 명확) |
Cilium NetworkPolicy, Cilium ClusterMesh 등과 자연스럽게 통합 |
| TLS 처리 | 단순 TLS 종료 지원 | 다양한 TLS 시나리오 지원 (SNI, 다중 리스너) |
Envoy 기반 TLS termination, mTLS 등 고급 기능 지원 |
| 상태 | GA, 사실상 Legacy | 표준화 진행 중, 업계 표준으로 자리잡는 중 | Gateway API 구현체 중 하나 (Cilium 특화) |
실습
사전준비
# CRD 설치
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.2.0/config/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.2.0/config/crd/standard/gateway.networking.k8s.io_gateways.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.2.0/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.2.0/config/crd/standard/gateway.networking.k8s.io_referencegrants.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.2.0/config/crd/standard/gateway.networking.k8s.io_grpcroutes.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.2.0/config/crd/experimental/gateway.networking.k8s.io_tlsroutes.yaml
# 확인
kubectl get crd | grep gateway.networking.k8s.io
gatewayclasses.gateway.networking.k8s.io 2025-08-17T04:27:28Z
gateways.gateway.networking.k8s.io 2025-08-17T04:27:28Z
grpcroutes.gateway.networking.k8s.io 2025-08-17T04:27:30Z
httproutes.gateway.networking.k8s.io 2025-08-17T04:27:29Z
referencegrants.gateway.networking.k8s.io 2025-08-17T04:27:29Z
tlsroutes.gateway.networking.k8s.io 2025-08-17T04:27:30Z
Cilium Gateway API 설정
#
helm upgrade cilium cilium/cilium --version 1.18.1 --namespace kube-system --reuse-values \
--set ingressController.enabled=false --set gatewayAPI.enabled=true
#
kubectl -n kube-system rollout restart deployment/cilium-operator
kubectl -n kube-system rollout restart ds/cilium
#
cilium config view | grep gateway-api
#enable-gateway-api true
#enable-gateway-api-alpn false
#enable-gateway-api-app-protocol false
#enable-gateway-api-proxy-protocol false
#enable-gateway-api-secrets-sync true
#gateway-api-hostnetwork-enabled false
#gateway-api-hostnetwork-nodelabelselector
#gateway-api-secrets-namespace cilium-secrets
#gateway-api-service-externaltrafficpolicy Cluster
#gateway-api-xff-num-trusted-hops 0
# cilium-ingress 제거 확인
kubectl get svc,pod -n kube-system
# The GatewayClass is a type of Gateway that can be deployed: in other words, it is a template. This is done in a way to let infrastructure providers offer different types of Gateways. Users can then choose the Gateway they like.
# For instance, an infrastructure provider may create two GatewayClasses named internet and private to reflect Gateways that define Internet-facing vs private, internal applications.
# In our case, the Cilium Gateway API (io.cilium/gateway-controller) will be instantiated.
# This schema below represents the various components used by Gateway APIs. When using Ingress, all the functionalities were defined in one API. By deconstructing the ingress routing requirements into multiple APIs, users benefit from a more generic, flexible and role-oriented model
# The actual L7 traffic rules are defined in the HTTPRoute API.
# In the next challenge, you will deploy an application and set up GatewayAPI HTTPRoutes to route HTTP traffic into the cluster.
kubectl get GatewayClass
#NAME CONTROLLER ACCEPTED AGE
#cilium io.cilium/gateway-controller True 2m19s
kubectl get gateway -A
#No resources found
Gateway API 배포
#
cat << EOF | kubectl apply -f -
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: my-gateway
spec:
gatewayClassName: cilium
listeners:
- protocol: HTTP
port: 80
name: web-gw
allowedRoutes:
namespaces:
from: Same
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: http-app-1
spec:
parentRefs:
- name: my-gateway
namespace: default
rules:
- matches:
- path:
type: PathPrefix
value: /details
backendRefs:
- name: details
port: 9080
- matches:
- headers:
- type: Exact
name: magic
value: foo
queryParams:
- type: Exact
name: great
value: example
path:
type: PathPrefix
value: /
method: GET
backendRefs:
- name: productpage
port: 9080
EOF
# You will see a LoadBalancer service named cilium-gateway-my-gateway which was created for the Gateway API.
kubectl get svc,ep cilium-gateway-my-gateway
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/cilium-gateway-my-gateway LoadBalancer 10.96.240.104 192.168.10.211 80:31017/TCP 96s
NAME ENDPOINTS AGE
endpoints/cilium-gateway-my-gateway 192.192.192.192:9999 96s
# The same external IP address is also associated to the Gateway:
kubectl get gateway
NAME CLASS ADDRESS PROGRAMMED AGE
my-gateway cilium 192.168.10.211 True 14s
## Accepted: the Gateway configuration was accepted.
## Programmed: the Gateway configuration was programmed into Envoy.
## ResolvedRefs: all referenced secrets were found and have permission for use.
kc describe gateway
#
kubectl get httproutes -A
NAMESPACE NAME HOSTNAMES AGE
default http-app-1 8m12s
# Accepted: The HTTPRoute configuration was correct and accepted.
# ResolvedRefs: The referenced services were found and are valid references.
kc describe httproutes
# Check Cilium Operator logs
kubectl logs -n kube-system deployments/cilium-operator | grep gateway'DevOps > cilium' 카테고리의 다른 글
| [Cilium Study] kube-burner (0) | 2025.08.30 |
|---|---|
| [Cilium Study] Mutual Authentication (0) | 2025.08.23 |
| [Cilium Study] Cilium Service Mesh 2 (1) | 2025.08.20 |
| [Cilium Study] Cilium Service mesh 1 (0) | 2025.08.17 |
| [Cilium Study] BGP / Cluster mesh 비교 (4) | 2025.08.17 |