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

[ENHANCEMENT] Restrict the manager's access permission #48

Open
starbops opened this issue Dec 24, 2024 · 0 comments
Open

[ENHANCEMENT] Restrict the manager's access permission #48

starbops opened this issue Dec 24, 2024 · 0 comments
Labels
area/rbac component/chart Relevant to the Helm chart component/manager Relevant to the custom Kubernetes controllers kind/enhancement Improve or augment existing functionality

Comments

@starbops
Copy link
Owner

While working on #13, I found that virtbmc-controller requires excessive permission to work. From virtbmc-controller's log:

...
manager W1224 15:11:30.504865       1 reflector.go:539] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: failed to list *v1.Pod: pods is forbidden: User "system:serviceaccount:kubevirtbmc-system:kubevirtbmc-manager" cannot list resource "pods" in API group "" at the cluster scope
manager E1224 15:11:30.504963       1 reflector.go:147] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1.Pod: failed to list *v1.Pod: pods is forbidden: User "system:serviceaccount:kubevirtbmc-system:kubevirtbmc-manager" cannot list resource "pods" in API group "" at the cluster scope
manager W1224 15:11:38.512892       1 reflector.go:539] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: failed to list *v1.Service: services is forbidden: User "system:serviceaccount:kubevirtbmc-system:kubevirtbmc-manager" cannot list resource "services" in API group "" at the cluster scope
manager E1224 15:11:38.512945       1 reflector.go:147] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1.Service: failed to list *v1.Service: services is forbidden: User "system:serviceaccount:kubevirtbmc-system:kubevirtbmc-manager" cannot list resource "services" in API group "" at the cluster scope

Apparently, the manager requires cluster-scoped permission to access Pods and Services across different namespaces. However, this is unnecessary. KubeVirtBMC only creates and manages virtbmc Pods and Services under the kubevirtbmc-system. Giving its ServiceAccount a ClusterRole power is overkilling. We might want to restrict it to be in the working namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rbac component/chart Relevant to the Helm chart component/manager Relevant to the custom Kubernetes controllers kind/enhancement Improve or augment existing functionality
Projects
Status: Backlog
Development

No branches or pull requests

1 participant