-
Notifications
You must be signed in to change notification settings - Fork 106
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
kube-mgmt resource replication requires cluster wide access #11
Comments
That seems like a reasonable configuration setting. The reason that kube-mgmt defaults to watching all namespaces is that it's intended to support OPA as an external admission controller for the cluster. This means that OPA is responsible for enforcing policy decisions that affect the entire cluster. To do this, OPA may need to have Kubernetes resources from any namespace. Minimally we could include some more information in the README about the permissions that OPA has to have. |
partially addressing: #11 Signed-off-by: ferantivero <[email protected]>
Since I understand that it might need to look across all namespaces but the current default behaviour is to constrain it to three namespaces and I'm assuming most users would want to restrict to a subset of namespaces. |
@alkar yes that makes sense. If you'd like to submit a PR, please go ahead. EDIT: The only bit I'm unsure about is whether client-go lets you specifying multiple namespaces to read from. Maintaining a set of N readers might be a bit more work. |
@tsandall very good point. I'll have a look and see if it's possible. |
Looking at |
Some of us are using kube-mgmt for things other than an admission controller and we don't always have the ability to access resources in every namespace. For these use cases it would be really useful if we could specify a list of namespaces on a per resource type basis. Something along the lines of: --replicate=v1/pods:default,ns1,ns2 This would only allow us to replicate pods from the namespaces named default, ns1, and ns2 while secrets would only be replicated from ns3. |
@rosskusler that seems reasonable. PRs are welcome. |
I tried to run the kube-mgmt sidecar to opa on my Kubernetes cluster and granted it limited privileges. The role that the deployment was running with only had access to it's own namespace and nothing else.
I only had
--replicate=v1/pods
as the argument tokube-mgmt
. I saw the following errors:If I understand the code right, it seems that
kube-mgmt
currently watches for resources across all namespaces.File: pkg/policies/configmap.go
File: ./pkg/data/generic.go
As a result, kube-mgmt can only run if it is given a role that has cluster wide access to these resources.
I changed the cluster-binding to cluster-admin (basically, ran opa and kube-mgmt as root) and things worked fine.
It'll be good if, kube-mgmt can watch resources in the namespace that the user provides (and maybe default to all).
The text was updated successfully, but these errors were encountered: