-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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-prometheus-stack] Restrict secrets access to namespace #4156
Comments
For the grafana subchart, you can fix this issue by setting |
Is it correct that you are looking for a toggle with reduces the scope of the prometheus-operator to the current scope? Same has grafana.rbac.namespaced? |
That would be a a good solution. The grafana helm chart also supports specifying your own cluster role or namespaced role (if the For my use case though something like |
@zaljic when I have set |
The following cluster role, role and role binding can be applied on top of the helm deployment of kube-prometheus-stack-operator-.zip Simply The cluster role and role I'm sure will require refinement so I'm not suggesting using these in a production environment! |
I have something in working draft already |
Any update on this? |
You can test #4283 |
I have cloned your repo and
the deployment of the helm chart fails with
nevertheless I do see
and
Also note that the cluster role From https://kubernetes.io/docs/concepts/security/rbac-good-practices/#listing-secrets Listing secrets |
Sadly, |
Here is a fully untested namespaced values yaml ---
grafana:
rbac:
namespaced: true
kube-state-metics:
rbac:
useClusterRole: false
prometheusOperator:
rbac:
namespaced: true
namespaces:
releaseNamespace: true
kubeletService:
enabled: false
prometheus:
rbac:
namespaced: true
kubelet:
enabled: false
coreDns:
enabled: false
kubeDns:
enabled: false
kubeApiServer:
enabled: false
kubeControllerManager:
enabled: false
kubeEtcd:
enabled: false
kubeProxy:
enabled: false
kubeScheduler:
enabled: false |
@jkroepke This allows for a clean deployment with the cluster role no longer having cluster wide secrets read permissions BUT when I have set grafana.rbac.namespaced to true there were no errors but the dashboards that come with kube-prometheus-stack do not show up anymore the list is empty. |
I tested that on a clean installation and I have dashboards as expected |
Is your feature request related to a problem ?
Currently, ClusterRoleBindings are used to attach the ClusterRole to the service account created in the Helm Chart. Read access to the secrets API is configured in the ClusterRole. This allows a potential attacker to read secrets from all namespaces in the Kubernetes cluster.
Describe the solution you'd like.
Instead of a ClusterRoleBinding, a RoleBinding should be used to only allow access to secrets in the namespace.
Describe alternatives you've considered.
NONE
Additional context.
Steps to reproduce:
global.rbac.create: true
kubectl cp kubectl kube-prometheus-stack-grafana-57b9499c74-5jgzl:/tmp -n monitoring -c grafana
chmod +x /tmp/kubectl
/tmp/kubectl auth whoami
/tmp/kubectl get secrets -n kube-system
The text was updated successfully, but these errors were encountered: