Projects Overview
Projects are Rancher’s primary multi-tenancy mechanism within a cluster. API Definition:pkg/apis/management.cattle.io/v3/authz_types.go:30-45
Project Resource
Key Fields
clusterName
The cluster this project belongs to. Immutable.backingNamespace
The namespace in the local (management) cluster used to store ProjectRoleTemplateBindings and project-scoped secrets. Typically matches the project name. Accessor method:GetProjectBackingNamespace() - pkg/apis/management.cattle.io/v3/authz_types.go:52-57
resourceQuota
Optional cluster-wide quota for all namespaces in the project. RequiresnamespaceDefaultResourceQuota if specified.
namespaceDefaultResourceQuota
Default quota applied to namespaces that don’t specify their own quota.RoleTemplate for Projects
Project-scoped RoleTemplates define permissions within a project’s namespaces. API Definition:pkg/apis/management.cattle.io/v3/authz_types.go:301-372
Specification
Key Fields
context
Must be set to"project" for project-scoped roles.
projectCreatorDefault
Iftrue, users who create a project automatically receive a binding with this role.
Example: The built-in project-owner role has this set to true.
Bootstrapping: During initialization, Rancher sets “project-owner” as the default for project creators.
Source: pkg/data/management/role_data.go:616-633
roleTemplateNames
Inherit rules from other RoleTemplates. Commonly used to inherit from Kubernetes default roles:admin- Kubernetes default admin roleedit- Kubernetes default edit roleview- Kubernetes default view role
ProjectRoleTemplateBinding (PRTB)
ProjectRoleTemplateBindings associate a subject (user or group) with a RoleTemplate in a specific project. API Definition:pkg/apis/management.cattle.io/v3/authz_types.go:378-412
Specification
Fields
All fields are immutable after creation. The namespace is the project’s backing namespace.projectName
Fully qualified project name in format<cluster-name>:<project-name>. Immutable.
Helper method: ObjClusterName() extracts the cluster name - pkg/apis/management.cattle.io/v3/authz_types.go:414-419
userName
Name of the Rancher User resource to bind.userPrincipalName
Name of a user principal to bind (alternative touserName).
groupName
Name of a Rancher Group to bind.groupPrincipalName
Name of a group principal to bind (alternative togroupName).
Note: Specify exactly one subject: userName, userPrincipalName, groupName, or groupPrincipalName.
roleTemplateName
Name of the RoleTemplate to apply.Built-in Project Roles
Rancher provides several built-in project-scoped RoleTemplates. Source:pkg/data/management/role_data.go:202-371
admin / edit / view
Display Names:- Kubernetes admin
- Kubernetes edit
- Kubernetes view
external: true- Reference Kubernetes built-in ClusterRolesbuiltin: true
project-owner
Display Name: Project Owner Description: Full administrative access to the project with ownership rights. Key Permissions:- Manage project members (
projectroletemplatebindings: all verbs) ownverb on the project resource- Create namespaces
- Manage persistent volume claims
- View persistent volumes and storage classes
- View and access cluster resources (nodes, API services)
- Manage monitoring resources (Prometheus, Grafana)
- Manage Istio resources (gateways, virtual services, policies)
- View catalog resources (apps, releases, cluster repos)
- Get local cluster resource
- Inherits from:
admin(Kubernetes admin role)
projectCreatorDefault: true- Assigned to project creatorsbuiltin: true
own verb allows deletion and full management of the project resource itself.
Source: pkg/data/management/role_data.go:203-226
project-member
Display Name: Project Member Description: Can manage workloads and most project resources but not project members. Key Permissions:- View project role template bindings (read-only)
- Create namespaces
- Manage persistent volume claims
- View persistent volumes and storage classes
- Manage workloads, services, ingresses
- Manage monitoring resources
- Manage Istio resources
- View catalog resources
- Inherits from:
edit(Kubernetes edit role)
pkg/data/management/role_data.go:228-249
read-only
Display Name: Read-only Description: Read-only access to all project resources. Key Permissions:- View all project and namespace resources
- View monitoring and Istio resources
- View catalog resources
- Inherits from:
view(Kubernetes view role)
pkg/data/management/role_data.go:251-271
Specialized Project Roles
create-ns
Display Name: Create Namespaces Permission: Create namespaces within the projectworkloads-manage
Display Name: Manage Workloads Permissions: Full control over pods, deployments, statefulsets, daemonsets, jobs, cronjobs, and related resourcesworkloads-view
Display Name: View Workloads Permissions: Read-only access to workload resourcesingress-manage / ingress-view
Display Name: Manage/View Ingress Permissions: Control or view ingress resourcesservices-manage / services-view
Display Name: Manage/View Services Permissions: Control or view services and endpointssecrets-manage / secrets-view
Display Name: Manage/View Secrets Permissions: Control or view secret resourcesconfigmaps-manage / configmaps-view
Display Name: Manage/View Config Maps Permissions: Control or view ConfigMap resourcespersistentvolumeclaims-manage / persistentvolumeclaims-view
Display Name: Manage/View Volumes Permissions: Control or view PVCsserviceaccounts-manage / serviceaccounts-view
Display Name: Manage/View Service Accounts Permissions: Control or view ServiceAccount resourcesprojectroletemplatebindings-manage / projectroletemplatebindings-view
Display Name: Manage/View Project Members Permissions: Control or view project membershipproject-monitoring-readonly
Display Name: Project Monitoring View Role Permissions: View Prometheus metrics in the project Properties:hidden: true - Not displayed in UI
Inherits from: view
monitoring-ui-view
Display Name: View Monitoring Permissions: Access monitoring UI proxy endpoints (Prometheus, Alertmanager, Grafana) External rules: Access via service proxy with specific resource namesMulti-Tenancy Model
Namespace Isolation
Projects provide namespace-level isolation:- Namespaces belong to exactly one project
- Users with project roles gain permissions in all project namespaces
- Resource quotas can be applied across all project namespaces
Project Membership
Project members are defined by PRTBs:- User or group is bound to a RoleTemplate via PRTB
- Rancher creates RoleBindings in each project namespace
- User gains permissions defined by the RoleTemplate
- As namespaces are added/removed from project, RoleBindings are reconciled
Cross-Namespace Permissions
Project roles automatically grant permissions across all namespaces in the project. Rancher maintains RoleBindings in each namespace that reference the same Role.Namespace Management
Adding Namespaces to Projects
Namespaces are associated with projects via labels or explicit assignment:Backing Namespace
Each project has a backing namespace that stores:- ProjectRoleTemplateBindings
- Project-scoped secrets (e.g., image pull secrets)
- Project-level resources
project.GetProjectBackingNamespace()
Source: pkg/apis/management.cattle.io/v3/authz_types.go:52-57
Default Namespaces
Projects track assignment of default and system namespaces via status conditions:DefaultNamespacesAssigned- Default namespaces have been createdSystemNamespacesAssigned- System namespaces have been assignedInitialRolesPopulated- Initial roles have been created
pkg/apis/management.cattle.io/v3/authz_types.go:14-19
Management Plane Integration
Project-Scoped Resources in Cluster Namespace
Some project-scoped resources exist in the cluster namespace rather than project namespace. Project roles need special handling to grant access: Example resources:- Cluster-scoped machine configs shared between projects
- Cluster catalogs visible to all projects
pkg/controllers/management/auth/manager.go:524-583
Cluster Owners Managing Project Members
Cluster owners can manage members of all projects in their cluster. Rancher grants this by:- Creating RoleBindings in each project’s backing namespace
- Binding the cluster owner to roles that allow managing PRTBs
- Labeling these RoleBindings with the CRTB identifier
pkg/controllers/management/auth/manager.go:463-522
Membership Bindings
When a PRTB is created, Rancher creates a “membership” RoleBinding in the project’s backing namespace:pkg/controllers/management/auth/manager.go:206-285
Project Ownership and Lifecycle
The “own” Verb
Theown verb on project resources indicates ownership:
- Can delete the project
- Full administrative control
- Can manage all project settings
pkg/controllers/management/auth/manager.go:868-879
Creator Defaults
When a user creates a project:- Project is created in a cluster namespace
- Rancher finds RoleTemplates with
projectCreatorDefault: true - Creates PRTB binding the creator to each matching role
- Creator immediately has full access
System Accounts
Clusters and projects can have system accounts for automation:pkg/systemaccount/systemaccount.go:17-22
Common Patterns
Creating a Custom Project Role
Grant workload management plus secret viewing:Binding a User to a Project Role
Binding a Group to Project Member
Inheriting Kubernetes Roles
Create a project role that extends Kubernetes “edit”:Troubleshooting
Check PRTB Status
Verify Namespace RoleBindings
In each project namespace:Verify Management Plane Access
In the management cluster:Common Issues
User cannot access project namespaces:- Verify PRTB exists in project backing namespace
- Check that namespaces have correct project label
- Ensure RoleTemplate exists and is not locked
- Verify project is in active state
- Check membership RoleBinding in project backing namespace
- Verify user has PRTB (not just downstream namespace access)
- RoleTemplate changes don’t automatically update existing Roles
- May need to recreate PRTB to trigger reconciliation
Related Resources
- RBAC Model - Overview of Rancher’s authorization system
- Global Roles - Global-level permissions
- Cluster Roles - Cluster-scoped permissions