Management access to the tenant cluster
Management access controls who can view, edit, or configure the tenant cluster object in the platform. It is separate from in-cluster access, which governs permissions inside the Kubernetes environment of the tenant cluster.
Default management accessβ
By default, the following users and roles have management access to a tenant cluster:
- Global administratorsβAccess all tenant clusters on the platform.
- Project administratorsβAccess all tenant clusters within their assigned projects.
- Tenant cluster ownersβAutomatically receive access to the specific tenant cluster they create or own.
- Users with physical cluster permissionsβAny user or team with RBAC permissions on the underlying (physical) cluster and the
useverb on thevirtualclusterinstancesresource in themanagement.loft.shAPI group can access tenant clusters running on that cluster.
Grant management access using the UIβ
To extend access to additional users or teams, use the Permissions section for each tenant cluster in the platform UI:
Open the Project dropdown in the top-left corner and select the project that contains the tenant cluster.
Click Tenant Clusters in the sidebar to view the list.
Click Edit on the target tenant cluster.
Open the Permissions tab.
Use the Add permission to field to select the user or team.
If the user or team does not appear, confirm that they have access to the project.
Choose a ClusterRole to assign (e.g.,
cluster-admin,edit, orview). This role determines the user's Kubernetes permissions inside the tenant cluster.Click Save changes.
The platform grants the selected user or team management access to the tenant cluster object.
vCluster rolesβ
vCluster roles define what users and teams can do inside the tenant cluster. Kubernetes RBAC governs this access.
Default cluster role assignmentβ
By default, the platform assigns the cluster-admin Kubernetes ClusterRole to users with tenant cluster access. This role grants full access in all namespaces.
Change the default cluster roleβ
Administrators can override the default role in the tenant cluster template or in the tenant cluster configuration.
Open the tenant cluster or template configuration.
Locate the Default Cluster Role field.
Enter a more limited role such as
editorview.Save the updated configuration.
Define custom role mapping rulesβ
Use mapping rules to assign specific users or teams to specific cluster roles.
- A user or team that matches at least one rule does not receive the default role.
- If multiple rules match, the system assigns all specified roles.
- If no rule matches, the system assigns the default role.
Open the tenant cluster or template YAML configuration.
Locate or create the
access.rulessection.List
subjectsfor each user or team.Define the ClusterRole for each rule.
Save and apply the configuration.
Exampleβ
apiVersion: management.loft.sh/v1
kind: VirtualCluster
metadata:
name: example-vcluster
spec:
defaultClusterRole: cluster-admin
access:
rules:
- subjects:
- kind: User
name: Person 1
clusterRole: edit
- subjects:
- kind: Team
name: DevTeam
clusterRole: view
In this example:
- Person 1 receives the
editrole. - DevTeam receives the
viewrole. - Person 1, if part of DevTeam, receives both roles.
- All other users default to
cluster-admin.
Custom mapping rules allow more precise and secure access control inside the tenant cluster.
Custom ClusterRolesβ
The platform UI's Permissions section lists only the four built-in roles: cluster-admin, admin, edit, and view. To use any other role, inject it into the tenant cluster using the objects field and reference it by name in access.rules.
Two approaches are available depending on what you need:
- Define a new ClusterRole β specify exactly the rules you want. Use this when you need to remove specific permissions from a built-in role.
- Aggregate into a built-in role β add rules to an existing role using Kubernetes label selectors. Use this when you need to extend a built-in role with additional access, without redefining its full rule set.
If the tenant cluster is deployed from a template, add objects to the template's spec.template. The template controls those fields and overrides any changes made directly on the tenant cluster.
Define a new ClusterRoleβ
Kubernetes RBAC is additive. A ClusterRole only grants what its rules explicitly allow. To restrict specific verbs from a built-in role, define a new ClusterRole that includes only the permissions you want.
One common scenario is a team that uses edit but must not be able to create PersistentVolumeClaims. For example, a shared PersistentVolume references a sensitive secret, and unrestricted PVC creation would expose that access.
apiVersion: management.loft.sh/v1
kind: VirtualClusterTemplate
metadata:
name: restricted-storage
spec:
template:
objects: |
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: edit-no-pvc-write
rules:
- apiGroups: [""]
resources: ["pods", "services", "configmaps", "secrets", "endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "delete"]
- apiGroups: ["apps"]
resources: ["deployments", "statefulsets", "daemonsets", "replicasets"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
access:
defaultClusterRole: cluster-admin
rules:
- teams:
- storage-restricted-team
clusterRole: edit-no-pvc-write
create, update, and patch are omitted from the persistentvolumeclaims entry. Those verbs return Forbidden for users assigned this role. To build from the full edit rule set, run kubectl get clusterrole edit -o yaml. Copy its rules section into objects and remove the verbs you want to block.
Extend a built-in role using aggregationβ
Kubernetes ClusterRole aggregation lets you inject additional rules into a built-in role using label selectors. The built-in admin, edit, and view roles each automatically aggregate any ClusterRole carrying the corresponding label:
| Label | Aggregates into |
|---|---|
rbac.authorization.k8s.io/aggregate-to-admin: "true" | admin |
rbac.authorization.k8s.io/aggregate-to-edit: "true" | edit |
rbac.authorization.k8s.io/aggregate-to-view: "true" | view |
The following example adds namespace creation to the admin role. Any team assigned admin automatically gains the added permission.
apiVersion: management.loft.sh/v1
kind: VirtualClusterInstance
metadata:
name: vcluster-rbac-example
spec:
template:
objects: |
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: admin-create-namespace
labels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rules:
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["create"]
access:
defaultClusterRole: view
rules:
- teams:
- api-framework
clusterRole: admin