Skip to content

HTTPRoute Routing and Validation

Interactive Diagram

새 탭 ↗
PlantUML Diagram

HTTPRoutes are placed in app namespaces and reference the Gateway in the envoy-gateway namespace via parentRefs.

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: nginx-proxy
spec:
parentRefs:
- name: platform-gateway
namespace: envoy-gateway
hostnames:
- "internal-app.NODE-IP.nip.io"
- "app.NODE-IP.nip.io"
rules:
- matches:
- headers:
- name: Host
value: internal-app.NODE-IP.nip.io
backendRefs:
- name: nginx-proxy
port: 9090
- matches:
- headers:
- name: Host
value: app.NODE-IP.nip.io
backendRefs:
- name: nginx-proxy
port: 8080
# pgadmin
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: pgadmin
spec:
parentRefs:
- name: platform-gateway
namespace: envoy-gateway
hostnames:
- "pgadmin.NODE-IP.nip.io"
rules:
- backendRefs:
- name: pgadmin
port: 5050
---
# rabbitmq
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: rabbitmq
spec:
parentRefs:
- name: platform-gateway
namespace: envoy-gateway
hostnames:
- "rabbitmq.NODE-IP.nip.io"
rules:
- backendRefs:
- name: rabbitmq
port: 15672
HTTPRouteHostnameBackendPort
nginx-proxyinternal-app.NODE-IP.nip.ionginx-proxy9090
nginx-proxyapp.NODE-IP.nip.ionginx-proxy8080
pgadminpgadmin.NODE-IP.nip.iopgadmin5050
rabbitmqrabbitmq.NODE-IP.nip.iorabbitmq15672

Using nip.io allows testing IP-based host routing without separate DNS configuration.


Envoy containers often run as non-root, so they may not bind directly to the same port as Service port (80/443). The actual listen port varies by xDS/version and must be verified inside the Pod using ss -tlnp or similar.

NameService portnodePorttargetPort
http803008010080
https4433044310080

If the HTTPS listener uses a separate port (e.g., 10443), the targetPort for the https entry must be separated.

If you omit port in the EnvoyProxy CR’s spec.ports JSON Merge patch, the API server may treat it as port: 0. When two ports both become 0/TCP, the following error occurs:

duplicate entries for key [port=0, protocol="TCP"]

Solution: Always explicitly specify port, targetPort, nodePort, and protocol for each entry.


  1. Envoy Gateway controller: Helm render + Kustomize apply
  2. External resources: GatewayClass → EnvoyProxy → TLS Secret → Gateway
  3. HTTPRoute: Apply in each app namespace (parentRefs references the Gateway)
  • Gateway / EnvoyProxy / GatewayClass references are based on envoy-gateway
  • Using kubectl apply -f ... -n other-ns may cause failures due to namespace mismatch with the object
  • → Use kubectl apply -k external/ or unify with -n envoy-gateway
Terminal window
# Gateway status
kubectl get gatewayclass,gateway -n envoy-gateway
# Envoy Proxy (data plane)
kubectl get svc -n envoy-gateway -l app.kubernetes.io/name=envoy
kubectl get ds -n envoy-gateway -l app.kubernetes.io/component=proxy
# HTTPRoute (all namespaces)
kubectl get httproute -A
# Endpoints
kubectl get endpoints -n envoy-gateway

When DNS/LB sends traffic to NodePort (or its frontend), requests are recorded in the Envoy access log.

Key fields to check in logs:

FieldMeaning
:authorityRequest Host
upstream_hostActual proxied Pod IP:port
response_codeUpstream response code
response_code_detailsvia_upstream = response generated by upstream (not Envoy)

Additional Observations (nginx proxy path)

Section titled “Additional Observations (nginx proxy path)”

When another host connects via nginx-proxy, the upstream may return a 301 redirect. In this case, response_code_details: via_upstream, and if LB/Envoy uses HTTPS while nginx only sees HTTP, X-Forwarded-Proto and similar settings need to be configured on the nginx side.

SegmentPort
Client → NodePort30080 (HTTP), 30443 (HTTPS)
Inside Envoy PodtargetPort 10080 (may vary by environment)

Always verify the actual LISTEN port using ss -tlnp or similar, then adjust manifests accordingly.


ItemResult
Gateway API-based L7 routingHost/path routing works correctly via HTTPRoute
Cross-namespace routingApps can reference Gateway from their own namespace
NodePort external exposureFixed at 30080/30443, easy LB/firewall integration
SecurityPolicy (IP control)Declarative access control at Gateway level
ClientTrafficPolicyClient IP detection via XFF
Coexistence with existing IngressIndependent operation as separate stack

Gateway API is the successor standard to Ingress, enabling declarative and structured routing management. Among its implementations, Envoy Gateway’s strength lies in data plane customization through the EnvoyProxy CR. The ability to coexist with existing Ingress while gradually migrating is a significant practical advantage.