Sub topic 12
Reading status conditions to debug
This chapter assumes you can apply YAML with kubectl and know the roles of GatewayClass, Gateway, and HTTPRoute. You should also know how parentRefs attach a route to a Gateway.
Why status matters
The Gateway API controller reports what it did with your configuration in the status field of each resource. A manifest that applies cleanly can still do nothing. The status tells you why. Each resource reports a list of conditions. A condition has a type, a status of True, False, or Unknown, a reason, and a human-readable message.
Which condition to check on each resource
| Resource | Condition type | What `True` means |
|---|---|---|
| GatewayClass | `Accepted` | A controller recognized the class and accepted it. |
| Gateway | `Accepted` | The controller accepted the Gateway's configuration. |
| Gateway | `Programmed` | The controller configured the data plane to match the Gateway. |
| Gateway listener | `Accepted`, `Programmed`, `ResolvedRefs` | The listener is valid, configured, and its references resolve. |
| HTTPRoute (per parent) | `Accepted` | The Gateway allowed the route to attach. |
| HTTPRoute (per parent) | `ResolvedRefs` | Every backend and filter reference resolved. |
Route conditions are reported per parent. An HTTPRoute with two parentRefs has two entries under status.parents, and each has its own conditions.
Debug from the top down
Start at the class and work toward the route. Each level depends on the one above it.
Run these commands:
kubectl get gatewayclass
kubectl get gateway -n infra web-gateway -o yaml
kubectl describe httproute -n shop-team shopThe first command shows the ACCEPTED column for each class. The second prints the full Gateway, including status.conditions and per-listener status, such as the count of attached routes. The third shows the route's parent status under Status: Parents.
Common failures and their causes
- GatewayClass
Accepted: Falseor no status at all. No installed controller uses thecontrollerNameyou set. Check that the controller is running and that the string matches the one in its documentation. - Gateway
Programmed: False. The listener may use an unsupported protocol, a port conflict, or a missing TLS Secret. Read thereasonandmessageon the listener. - HTTPRoute
Accepted: False, reasonNotAllowedByListeners. The listener'sallowedRoutesdoes not permit the route's namespace. Add the label the selector expects, for exampleshop-shared-gateway-access=true, to the route's namespace. - HTTPRoute
Accepted: False, reasonNoMatchingListenerHostname. The route'shostnamesdo not intersect with the listener'shostname. - HTTPRoute
ResolvedRefs: False, reasonBackendNotFound. The Service name or namespace is wrong. If the Service is in another namespace, check that a ReferenceGrant exists, in which case the reason isRefNotPermitted. - Everything is
Truebut requests fail. The configuration is valid. Look at the Service's endpoints withkubectl get endpointsand at the Pods' readiness.
Reason strings can vary slightly between releases and controllers, so rely on the message text as well.
Exercise
An HTTPRoute shows Accepted: True but ResolvedRefs: False with reason RefNotPermitted. The route is in shop-team, and its backend Service is in backend. What is wrong, and how do you fix it?
Show answer
The Gateway allowed the route to attach, but the route references a Service in another namespace without permission. Create a ReferenceGrant in the backend namespace that lists HTTPRoute from shop-team in from and Service in to.