List all Gateway API resources

One view of classes, gateways and routes in all namespaces

kubectl get gatewayclass,gateway,httproute -A

tool
gateway-api5 commands
tags
gateway-apinetworkk8s

More gateway-api commands

  • kubectl apply -f - <<'EOF' apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: {name: web, namespace: <ns>} spec: parentRefs: [{name: gw}] rules: - backendRefs: - {name: web-stable, port: 80, weight: 90} - {name: web-canary, port: 80, weight: 10} EOF

    Send 90% of traffic to stable and 10% to canary by weight

  • kubectl apply -f - <<'EOF' apiVersion: gateway.networking.k8s.io/v1beta1 kind: ReferenceGrant metadata: {name: allow-routes, namespace: backend} spec: from: [{group: gateway.networking.k8s.io, kind: HTTPRoute, namespace: edge}] to: [{group: "", kind: Service}] EOF

    Lets HTTPRoutes in the edge namespace point to Services in the backend namespace

  • kubectl apply -f - <<'EOF' apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: {name: gw, namespace: <ns>} spec: gatewayClassName: <name> listeners: - name: https protocol: HTTPS port: 443 tls: mode: Terminate certificateRefs: [{name: tls-cert}] EOF

    Terminate TLS on the gateway with certificateRefs that point to a Secret

  • kubectl describe httproute <name> -n <ns> | grep -A8 Conditions

    Check Accepted and ResolvedRefs to find out why a route is not attached

all 5 gateway-api commands