Skip to content

kro: “is forbidden … cannot get resource” – controller without permissions

GitOpstested on kro 0.10.0 auf k3s v1.37.2+k3s1

kro shows all instances as ACTIVE, but a manually changed replica count stays. The log shows why: kro's service account may not even read its own kinds.

Symptom

kubectl -n kro-system logs deploy/kro --since=1m | grep -m1 forbidden
... ERROR dynamic-controller Error syncing item, requeuing with rate limit {"item":
{"name":"notes","namespace":"app"}, "error": "failed loading instance:
notesapps.lab.example.com \"notes\" is forbidden: User
\"system:serviceaccount:kro-system:kro\" cannot get resource \"notesapps\" in API
group \"lab.example.com\" in the namespace \"app\""}

The instances' STATE only says what kro wrote last.

Diagnosis

The proof: a manual change is no longer reset.

kubectl -n app scale deploy notes --replicas=2
kubectl -n app get deploy notes
deployment.apps/notes scaled
NAME    READY   UP-TO-DATE   AVAILABLE   AGE
notes   1/2     2            1           14m

Causes

Aggregationkro lacks permissions for its own kinds

With the aggregated role kro:controller, kro only has the static permissions for RGDs, CRDs and leases. A role with the label rbac.kro.run/aggregate-to-controller is missing for the NotesApps and the objects they contain.

STATE ACTIVEThe status is stale

The instances still show ACTIVE, but that is what kro wrote last. Only the logs – and the missing drift correction – reveal whether kro is working.

Fix

Create a ClusterRole with the label rbac.kro.run/aggregate-to-controller that allows the own kinds (with /status) and all object kinds of the RGDs. On the next attempt kro resets the drift.
kubectl auth can-i get notesapps -n app --as=system:serviceaccount:kro-system:kro
kubectl apply -f kro-notes-rbac.yaml
kubectl auth can-i get notesapps -n app --as=system:serviceaccount:kro-system:kro
no
clusterrole.rbac.authorization.k8s.io/kro:controller:notes created
yes

Don't: Giving kro cluster-admin. Then the controller may do everything in the cluster, including other teams' secrets.

▶
Break it yourself and find it – free
kro hands-on, day 12: operations – aggregated permissions, permissions for teams, metrics and alerts.
Go to day 12 →

FAQ

Why does kro need permissions on /status?

kro writes the status with server-side apply and needs the subresource for that.

How do I monitor this?

With the metric instance_reconcile_errors_total: the forbidden errors make it rise.

Related error patterns

More