-
Environmental Info: Node(s) CPU architecture, OS, and Version: Cluster Configuration: 3 servers, 5 agents Describe the bug: I am using pod security admission to restrict my pods to the baseline PodSecurity level for the entire cluster. Due to having some resources that require exemption, I tried using the username approach, but the controller fails to create new pods because that violates the PodSecurity baseline rule. When using namespace exemption the problem is gone. Steps To Reproduce: On the cluster nodes
On the cluster
Expected behavior: The controller is successfully creating pod(s) for the deployment The controller fails to create pods because it's forbidden due to violating the PodSecurity rule |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Converted this to a discussion since this is core Kubernetes functionality that you're asking about, and not anything specific to RKE2.
I don't think that the username is just the literal service account name. If this was the case then service accounts in different namespaces would be indistinguishable. I think that the actual "user" for the serviceaccount is derived in the format Again, this is just core Kubernetes stuff that you should be able to find covered in the upstream docs:
|
Beta Was this translation helpful? Give feedback.
-
Most pods are created by a controller in response to a workload resource, meaning that exempting an end user will only exempt them from enforcement when creating pods directly, but not when creating a workload resource. Controller service accounts (such as system:serviceaccount:kube-system:replicaset-controller) should generally not be exempted, as doing so would implicitly exempt any user that can create the corresponding workload resource. |
Beta Was this translation helpful? Give feedback.
Most pods are created by a controller in response to a workload resource, meaning that exempting an end user will only exempt them from enforcement when creating pods directly, but not when creating a workload resource. Controller service accounts (such as system:serviceaccount:kube-system:replicaset-controller) should generally not be exempted, as doing so would implicitly exempt any user that can create the corresponding workload resource.
https://docs.microfocus.com/doc/SMAX/24.4/KubernetesPSA