응답 계속 진행
HTTPRoute는 '어떤 경로의 요청을 어떤 Service로 보낼 것인가'를 정의합니다. parentRefs로 Gateway를 참조하고, rules에서 라우팅 규칙을 설정합니다. 지금은 모든 경로(/)를 notiflex-api Service로 보냅니다.
나중에 5.3에서 Blue/Green 배포를 설정할 때 이 HTTPRoute의 backendRefs에 가중치(weight)를 추가하여 트래픽을 분배하게 됩니다. Gateway API를 선택한 핵심 이유 중 하나입니다.
k8s/gateway/httproute.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: notiflex-route
namespace: notiflex
spec:
parentRefs:
- name: notiflex-gateway
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: notiflex-api
port: 80
$ kubectl --context gke-sysnet4admin_book_gitaiops apply -f k8s/gateway/httproute.yaml
httproute.gateway.networking.k8s.io/notiflex-route created