Skip to content

Gateway API: certificate ref not permitted – secret in another namespace

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

The certificate belongs to the app team, the listener to the platform team. For the gateway to read the secret, the owner of the secret must explicitly allow it.

Symptom

conds.sh gateway web infra | grep -A2 https-aktion
listener https-aktion (attachedRoutes=0):
  ResolvedRefs=False (RefNotPermitted): No valid secrets exist: certificate refs 0:
Certificate ref to secret shop/shop-own-tls not permitted by any ReferenceGrant.

The new listener https-aktion uses the secret shop-own-tls from the namespace shop.

Diagnosis

Check that the certificate itself is ready – then only the permission is missing.

kubectl -n shop wait certificate/shop-own --for=condition=Ready --timeout=60s
certificate.cert-manager.io/shop-own condition met

Causes

RefNotPermittedPermission from the secret owner is missing

A gateway may only read a secret in another namespace if a ReferenceGrant there allows gateways from its namespace.

ListenersNotValidOnly this listener is affected

The gateway reports Accepted=True (ListenersNotValid) – the other listeners keep working.

Fix

The shop team allows gateways from infra to use the secret.
kubectl apply -f refgrant-secret.yaml
referencegrant.gateway.networking.k8s.io/infra-gateway-to-shop-cert created
  ResolvedRefs=True (ResolvedRefs): Listener references have been resolved

Don't: Copying the secret to infra – then nobody renews it and it expires unnoticed.

▶
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

Does cert-manager issue the certificate for such a listener?

No. The cert-manager shim issues nothing for listeners with certificateRefs in another namespace – the certificate is the job of the team that owns the secret.

Must the ReferenceGrant name the secret?

Not necessarily, but it is better: to.name limits the permission to exactly this secret.

Related error patterns

More