Setting service accounts and role-based access control on Kubernetes
For db2u instances deployed on a Kubernetes cluster version 1.25 and later, users need to apply Pod Security Admission (PSA) labels to their dedicated working namespaces rather than PodSecurityPolicy (PSP).
About this task
To grant limited privileges to db2u pods, users need to customize their own serviceAccount (SA) and role-based access control (RBAC) bindings. If users do not specify a SA, the Db2 Operator will automatically generate the SA and assign the required resource accessibility.
PodSecurityPolicy (PSP) is officially deprecated in Kubernetes version 1.25 and later. PSP is replaced by Pod Security Admission (PSA). For db2u instances deployed on a Kubernetes cluster version 1.25 and later, users need to apply PSA labels to their dedicated working namespace.
Based on the official Kubernetes wiki on pod security levels, Kubernetes users
currently have three privilege levels. Db2u requires the privileged level to work.
The privileged level is unrestricted and provides the widest possible level of
permissions.
To apply the PSA label, assign the enforced=privileged level to your Db2u
namespace:
kubectl label ns <db2u-namespace> pod-security.kubernetes.io/enforce=privileged
To review the labels you have updated, run this command:
kubectl get ns --show-labels