Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeRestriction Admission Controller Plugin: Update and Patch Pod Permissions #124094

Open
valafon opened this issue Mar 28, 2024 · 5 comments
Open
Assignees
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.

Comments

@valafon
Copy link

valafon commented Mar 28, 2024

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?

@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 28, 2024
@valafon
Copy link
Author

valafon commented Mar 28, 2024

/sig auth
/sig node

@k8s-ci-robot k8s-ci-robot added sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/node Categorizes an issue or PR as relevant to SIG Node. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 28, 2024
@aramase
Copy link
Member

aramase commented Apr 1, 2024

/assign

(comment on using VAP)

@enj
Copy link
Member

enj commented Apr 2, 2024

xref: openshift/origin#28673

@enj
Copy link
Member

enj commented Apr 3, 2024

@valafon the approach described in kubevirt/kubevirt#9109 (comment) should handle your use case.

@stlaz
Copy link
Member

stlaz commented Apr 8, 2024

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
Status: Backlog
Development

No branches or pull requests

5 participants