Skip to content

Gateway API: RefNotPermitted – backend in another namespace, HTTP 500

Networkingtested on Envoy Gateway auf kind, Gateway API Standard-Channel

Accepted=True and still HTTP 500: the route is attached to the listener, but its backend lives in another namespace. Without permission from the target team, the Gateway API refuses the reference.

Symptom

s shop.gw.localtest.me /checkout -o /dev/null -w '%{http_code}\n'
500

The shop route sends /checkout to the service payments-api in the namespace payments.

Diagnosis

Read the route conditions.

conds.sh httproute checkout shop
parent infra/web/https-shop:
  Accepted=True (Accepted): Route is accepted
  ResolvedRefs=False (RefNotPermitted): Failed to process route rule 0 backendRef 0:
Backend ref to Service payments/payments-api not permitted by any ReferenceGrant.

Causes

RefNotPermittedPermission from the target namespace is missing

References across namespaces are only allowed if the owner of the target permits them with a ReferenceGrant in their namespace.

Accepted=TrueThe route itself is fine

Accepted=True only means the route is attached to the listener. For the one rule with the forbidden backend Envoy answers with 500; all other rules work.

Fix

The target team creates a ReferenceGrant in its namespace that allows HTTPRoutes from shop to point to exactly this service.
kubectl apply -f refgrant-backend.yaml
referencegrant.gateway.networking.k8s.io/shop-to-payments-api created
  ResolvedRefs=True (ResolvedRefs): Resolved all the Object references for the Route
payments-api payments

Don't: Creating the ReferenceGrant in the route's namespace – it belongs in the target's namespace, otherwise it has no effect.

▶
Break it yourself and find it – free
Gateway API hands-on, Day 7: tenants with allowedRoutes, ReferenceGrants for backends and certificates, ListenerSets.
Go to day 7 →

FAQ

What does to.name do in a ReferenceGrant?

It limits the permission to exactly one service. Without name it applies to all services in the target namespace.

Does this apply to TLS certificates too?

Yes. If a listener points to a secret in another namespace, the gateway also reports RefNotPermitted until the owner of the secret creates a ReferenceGrant.

Related error patterns

More