Manage Trident protect authorization and access control
Trident protect uses the Kubernetes model of role-based access control (RBAC). By default, Trident protect provides a single system namespace and its associated default service account. If you have an organization with many users or specific security needs, you can use the RBAC features of Trident protect to gain more granular control over access to resources and namespaces.
The cluster administrator always has access to resources in the default trident-protect
namespace, and can also access resources in all other namespaces. To control access to resources and applications, you need to create additional namespaces and add resources and applications to those namespaces.
Note that no users can create application data management CRs in the default trident-protect
namespace. You need to create application data management CRs in an application namespace (as a best practice, create application data management CRs in the same namespace as their associated application).
|
Only administrators should have access to privileged Trident protect custom resource objects, which include:
As a best practice, use RBAC to restrict access to privileged objects to administrators. |
For more information about how RBAC regulates access to resources and namespaces, refer to the Kubernetes RBAC documentation.
Fore information about service accounts, refer to the Kubernetes service account documentation.
Example: Manage access for two groups of users
For example, an organization has a cluster administrator, a group of engineering users, and a group of marketing users. The cluster administrator would complete the following tasks to create an environment where the engineering group and the marketing group each have access to only the resources assigned to their respective namespaces.
Step 1: Create a namespace to contain resources for each group
Creating a namespace enables you to logically separate resources and better control who has access to those resources.
-
Create a namespace for the engineering group:
-
Create a namespace for the marketing group:
Step 2: Create new service accounts to interact with resources in each namespace
Each new namespace you create comes with a default service account, but you should create a service account for each group of users so that you can further divide privileges between groups in the future if necessary.
-
Create a service account for the engineering group:
-
Create a service account for the marketing group:
Step 3: Create a secret for each new service account
A service account secret is used to authenticate with the service account, and can easily be deleted and recreated if compromised.
-
Create a secret for the engineering service account:
-
Create a secret for the marketing service account:
Step 4: Create a RoleBinding object to bind the ClusterRole object to each new service account
A default ClusterRole object is created when you install Trident protect. You can bind this ClusterRole to the service account by creating and applying a RoleBinding object.
-
Bind the ClusterRole to the engineering service account:
-
Bind the ClusterRole to the marketing service account:
Step 5: Test permissions
Test that the permissions are correct.
-
Confirm that engineering users can access engineering resources:
-
Confirm that engineering users cannot access marketing resources:
Step 6: Grant access to AppVault objects
To perform data management tasks such as backups and snapshots, the cluster administrator needs to grant access to AppVault objects to individual users.
-
Create and apply an AppVault and secret combination YAML file that grants a user access to an AppVault. For example, the following CR grants access to an AppVault to the user
eng-user
: -
Create and apply a Role CR to enable cluster administrators to grant access to specific resources in a namespace. For example:
-
Create and apply a RoleBinding CR to bind the permissions to the user eng-user. For example:
-
Verify that the permissions are correct.
-
Attempt to retrieve AppVault object information for all namespaces:
You should see output similar to the following:
Error from server (Forbidden): appvaults.protect.trident.netapp.io is forbidden: User "system:serviceaccount:engineering-ns:eng-user" cannot list resource "appvaults" in API group "protect.trident.netapp.io" in the namespace "trident-protect"
-
Test to see if the user can get the AppVault information that they now have permission to access:
You should see output similar to the following:
yes
-
The users you have granted AppVault permissions to should be able to use authorized AppVault objects for application data management operations, and should not be able to access any resources outside of the assigned namespaces or create new resources that they do not have access to.