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

[Feature]: Install Grafana dashboard in the namespace where kube-prometheus is located #138

Closed
2 tasks done
yangy30 opened this issue Jun 1, 2023 · 6 comments · Fixed by #168
Closed
2 tasks done
Assignees

Comments

@yangy30
Copy link

yangy30 commented Jun 1, 2023

Checklist

  • I've searched for similar issues and couldn't find anything matching
  • I've discussed this feature request in the K8sGPT Slack and got positive feedback

Is this feature request related to a problem?

Yes

Problem Description

Without making any modifications, the dashboard will be installed in the namespace where k8sgpt is located. If the namespaces of kube-prometheus and k8sgpt are different, the dashboard will not work.

Solution Description

Adding namespace options in helm

Benefits

Can make the Grafana dashboard work smoothly.

@AlexsJones
Copy link
Member

We create a configmap that has a grafana_dashboard label, if you want to enable grafana_dashboards across namespaces you can do that through kube-prometheus.

When you say the grafana dashboard, are you talking about the configmap we create with the dashboard json?

@yangy30
Copy link
Author

yangy30 commented Jun 4, 2023 via email

@AlexsJones
Copy link
Member

This should be and released right @arbreezy

@arbreezy
Copy link
Member

arbreezy commented Jun 6, 2023

similar behaviour has been implemented for Prom ServiceMonitor
@AlexsJones,
What we need is, users to be able to define the namespace the configMap is going to be deployed rather than changing the kube-prom configuration to scrape the k8sgpt's namespace. Small change, I can pick it up but I think is also a nice first GH issue.

@yangy30
Copy link
Author

yangy30 commented Jun 7, 2023

I would like to add a little more about the installation method of my Prometheus, as I have noticed that there are some differences in the establishment of monitors among different installation methods

I am using the config in the manifests directory, which is different from the kube-prometheus-stack installed by helm

For the GrafanaDashboard, I found that my Grafana cannot automatically scan and load configmap, and can only be manually mounted in deploy. Therefore, I believe it is necessary to install configmap in Prometheus' namespace

Also, if prometheus and k8sgpt are not in the same namespace, Then the administrator needs to add permissions to prometheus, otherwise the monitoring item will not be found

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: prometheus-role
  namespace: k8sgpt-operator-system
rules:
- apiGroups:
  - ""
  resources:
  - services
  - pods
  - endpoints
  verbs:
  - watch
  - list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: prometheus-rolebinding
  namespace: k8sgpt-operator-system
subjects:
- kind: ServiceAccount
  name: prometheus-k8s
  namespace: monitoring
roleRef:
  kind: Role
  name: prometheus-role
  apiGroup: rbac.authorization.k8s.io

@MateSousa
Copy link
Contributor

@arbreezy can I do ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants