Kubernetes auth in OpenBao checks at login whether the token's service account and namespace match the role. A SecretStore in a foreign namespace using another team's role is rejected here – and that is intended.
Symptom
kubectl -n fremd get ss openbao NAME AGE STATUS CAPABILITIES READY openbao 3s InvalidProviderConfig False
A SecretStore in the namespace fremd (“foreign”) uses the role shop-api.
Diagnosis
The SecretStore's event contains OpenBao's answer.
kubectl -n fremd get events --field-selector involvedObject.kind=SecretStore \
-o jsonpath='{.items[0].message}'
unable to log in to auth method: unable to log in with Kubernetes auth: Error making
API request.
URL: PUT http://openbao.openbao.svc:8200/v1/auth/kubernetes/login
Code: 403. Errors:
* service account name not authorized
Causes
BindingThe role binds a different SA or namespace
The role shop-api binds only the service account shop-api in the namespace shop. Every other token is rejected.
SecretStoreA SecretStore can only use SAs from its namespace
A namespaced SecretStore may only use service accounts from its own namespace; serviceAccountRef.namespace is ignored.
Fix
Don't: Do not widen the role's binding to * – then every service account in the cluster can read the team's secrets.
OpenBao secrets in Kubernetes and CI/CD, Day 4: advanced ESO – templates, multi-tenancy with one SecretStore per namespace, PushSecret.
Go to day 4 →
FAQ
Why doesn't OpenBao give a more precise message?
So an attacker does not learn which combination of service account and namespace would be allowed.
What about ClusterSecretStore?
A ClusterSecretStore may reference service accounts from other namespaces – which is exactly why it belongs under the platform team's control.