Repository navigation
Description
Summary
Running ax install on GKE as an identity that can create namespaced objects but not ClusterRoles (such as a service account with the project Editor role) registers ax-server in the ate-api-server bootstrap owners and rolls the Agent Substrate API server, edits the credential provider policy, and deploys ax-postgres and ax-server. Only after that does it fail on clusterroles.rbac.authorization.k8s.io is forbidden. It exits 1 and leaves ax-server running without its ClusterRole, while ax ctx reports the tunnel as Healthy. The prerequisites in docs/installation.md list port forwarding, ClusterTrustBundles, and PodCertificateRequests, but not cluster-scoped RBAC.
Environment
- Originally reproduced on AX
mainat8e2a187, Agent Substrate v1.0.0, GKE 1.37.2. - Rechecked on
mainat275d0b69:internal/install/axdeploy/deploy.gostill has no permission preflight beforeGrantSubstrateAccess, anddocs/installation.mdprerequisites are unchanged.
Steps to reproduce
- As an identity without permission to create ClusterRoles, run
ax install --context <gke-context>with the image flags. - Run
kubectl -n ax-system get deploy,podsandax ctx.
Expected behavior
A preflight error that names the missing permission, with nothing changed on the cluster.
Actual behavior
==> Registered system:serviceaccount:ax-system:ax-server in ate-api-server --authz-bootstrap-owners; waiting for rollout...
==> Updated k8s-credential-provider-namespace-policy for namespace "ax-system"; restarting k8s-credential-provider...
==> Deploying ax-postgres in namespace "ax-system"...
==> Deploying ax-server (...)...
Error: applying ax-server: ... clusterroles.rbac.authorization.k8s.io is forbidden: User "<service account>" cannot create resource "clusterroles" ...
After that, kubectl showed deployment.apps/ax-server 1/1, and ax ctx showed the tunnel to ax-system/ax-server as Healthy. Run again as a cluster admin, ax install took 11.5 s and exited 0.
Suggested fix
Check the needed permissions before the first change using a preflight with SelfSubjectAccessReview (the API behind kubectl auth can-i), and add creating ClusterRoles and ClusterRoleBindings (on GKE, roles/container.admin) to the prerequisites in docs/installation.md.
Impact
- Severity: P2. Teams where developers do not hold cluster admin, which is common on shared GKE clusters.
- Workaround: run
ax installas a cluster admin.
Activity
chilin0525 commentedon Dec 1, 2026
@mayawang I reproduced this on Kind at
938dc1ewith a ServiceAccount that can't create ClusterRoles.ax installchanged Agent Substrate and deployed ax-postgres and ax-server before failing withclusterroles.rbac.authorization.k8s.io is forbidden:I'd like to work on this. Here is my proposal; I'd like to confirm the scope before implementation.
Proposal
internal/install/axdeploy/preflight.go. It runs beforeGrantSubstrateAccess, the first change to the cluster, and sendsSelfSubjectAccessReview(SSAR) requests through the existing kubectl wrapper.roles/container.admin).Open Questions
Should the preflight check all of these permissions, or only the
ClusterRoleandClusterRoleBinding?get, pluscreateif missing orpatchif it existsgetandpatch, pluscreateif missingget, pluscreateif missing orpatchif it existsax-postgresSecretget, pluscreateif missingax-serverDeployment andax-postgresStatefulSet (rollout)list,watchate-systemate-api-serverandatenet-routerDeploymentsget, pluspatch,list, andwatchif ax-server isn't registered yetate-systemk8s-credential-provider-namespace-policyConfigMapget, pluspatchif it exists and needs updatingate-systemk8s-credential-providerDeploymentget,patch,list, andwatch, if the ConfigMap needs updating and the Deployment existsI suggest checking all of them, because a missing permission on any of them can also leave a partial install.
Should this fix also cover RBAC escalation prevention? SSAR can tell whether the caller may create a
ClusterRole, but not whether they may grant the permissions in it. A caller who can createClusterRoles, but can't grant cluster-wide access to Secrets, would pass the preflight and could still end up with a partial install.Jefftree commentedon Dec 3, 2026
feels a bit overkill and bloats the installation script imo.
this feels like the better angle.
docs: document cluster-admin prerequisite for ax install (#827)