Why do we get Forbidden on the management cluster?
A kubectl Forbidden error on the management cluster means the login worked, but your user or token is not allowed to do that action in that namespace. The message names the user, the action, the resource and the namespace:
Error from server (Forbidden): clusters.cluster.x-k8s.io is forbidden: User "<user>" cannot list resource "clusters" in API group "cluster.x-k8s.io" in the namespace "default"
The usual causes:
- No role. The user exists in Syself ID but has no role under Authorizations. Grant one as shown in Roles and permissions. Then log in again: run
rm -rf ~/.kube/cache/oidc-loginand anykubectlcommand. - Read-only role.
org-<company-name>can view objects but cannot create, change or delete them. It also cannot fetch a Secret by name, so downloading<cluster-name>-kubeconfigfails. Use a user withorg-<company-name>-admins. - Wrong namespace. Your role is valid only in
org-<company-name>. Without a namespace in the kubeconfig,kubectlusesdefault, as in the message above. Use the kubeconfig template from Access the management cluster, which has the namespace set. - Pipeline token. The
gitops-sa-secrettoken managesClusterandHetznerBareMetalHostobjects but cannot create or change Secrets. What it can do is listed in How do we give a CI pipeline headless access to the management cluster? - Free plan limit. The free plan covers 1 cluster with up to 5 servers, control-plane nodes included. A second cluster or a sixth server is refused with a Forbidden error that names the limit.
A different message, the server doesn't have a resource type "clusters", means kubectl points at the wrong cluster. In that case, see what to check when a resource type is missing.
If the cause is still unclear, send the full error message to Syself support.
Related questions
