← All cheatsheets
$ kubectl get gateways,httproutes -AInstall the Gateway API CRDs, inspect Gateways and Routes, debug route status, and copy common manifests for routing and traffic splitting.
Install and inspect
Pick the latest version from the Gateway API releases page and replace the version below.
kubectl apply --server-side -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.3.0/standard-install.yamlInstall the standard channel CRDskubectl get crd | grep gateway.networking.k8s.ioCheck which Gateway API CRDs existkubectl get gatewayclassList GatewayClasses and their controllerskubectl get gateways -AList Gateways and their addresseskubectl get httproutes -AList HTTPRouteskubectl get grpcroutes,tlsroutes -AList gRPC and TLS routeskubectl get referencegrants -AList cross-namespace permissionsDebugging
kubectl describe gateway web -n infraCheck listener status and attached routeskubectl get httproute app -n default -o jsonpath="{.status.parents[*].conditions}"See if a route was accepted and resolvedkubectl get gateway web -n infra -o jsonpath="{.status.addresses[*].value}"Get the Gateway IP or hostnamecurl -H "Host: app.example.com" http://$GATEWAY_IP/Test routing by host headerGateway
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: web
namespace: infra
spec:
gatewayClassName: eg
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: AllHTTPRoute with a 90/10 traffic split
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: app
namespace: default
spec:
parentRefs:
- name: web
namespace: infra
hostnames: ["app.example.com"]
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: app-v1
port: 80
weight: 90
- name: app-v2
port: 80
weight: 10