NodeRestriction Admission Controller Plugin: Update and Patch Pod Permissions #124094
Labels
sig/auth
Categorizes an issue or PR as relevant to SIG Auth.
sig/node
Categorizes an issue or PR as relevant to SIG Node.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
Hello, community! We've encountered the following issue: in our Kubernetes cluster, there was a need to grant certain plugin the same rights as kubelet to add specific annotations to a pod, depending on which node it has been scheduled to. The plugin works if we create a cluster role and a service account with rights to update/patch a pod. However, the problem is that, in such a case, it has the ability to modify pods across the entire cluster, which is unsafe. To solve this problem, so that annotations could be changed only on the node where it is running, we decided to use the NodeRestriction plugin, just as it works out of the box for kubelet (using a certificate in the system:nodes group and common name system:node:node_name). The issue is that, out of the box, the system:node only has rights to create/delete pods. But even if I add the system:nodes group rights on update/patch verbs, the NodeRestriction admission controller still intervenes and forbids pod updates, with this error:
Failed due to pods "pod-name" is forbidden: unexpected operation "UPDATE", node "node123" can only create and delete mirror pods.
I looked into the documentation and also studied the source code, and it seems that NodeRestriction lacks ways to add additional allowed verbs for pod modifications. Dear community, has anyone solved this problem? Is there a way to deal with this issue out of the box, without rewriting the NodeRestriction code?
The text was updated successfully, but these errors were encountered: