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

Add premade dashboard to monitor Traefik [enhancement] #794

Closed
Adam-D-Lewis opened this issue Aug 26, 2021 · 9 comments · Fixed by #797
Closed

Add premade dashboard to monitor Traefik [enhancement] #794

Adam-D-Lewis opened this issue Aug 26, 2021 · 9 comments · Fixed by #797
Assignees
Labels
type: enhancement 💅🏼 New feature or request

Comments

@Adam-D-Lewis
Copy link
Member

I'm looking into adding https://github.com/tcheronneau/grafana_dashboard to the qhub deployment for Traefik. The dashboard doesn't work off the bat. I'm still working on making the changes to get it working.

@Adam-D-Lewis Adam-D-Lewis added the type: enhancement 💅🏼 New feature or request label Aug 26, 2021
@Adam-D-Lewis Adam-D-Lewis self-assigned this Aug 26, 2021
@Adam-D-Lewis
Copy link
Member Author

Adam-D-Lewis commented Aug 26, 2021

The steps as I understand them now:

  1. Configure traefik to output metrics for prometheus
  2. Get prometheus to talk to traefik
  3. Create or import dashboard showing Traefik stats

I've made a start on step 1 at https://github.com/Quansight/qhub/tree/prometheus_grafana.
I'm trying step 2 (manually) at https://github.com/Quansight/grafana-prometheus-qhub. It seems that prometheus is not able to get the metrics from traefik. I'm not sure if I need to add a service that routes prometheus to the traefik pod. Trying a few different things. After port forwarding port 9090 on the prometheus pod, I can see the Traefik target that I'm trying to add, but it's not working yet.

image

Also, I'd assume we don't want the metrics available publicly since then anyone could set up their own prometheus to poll metrics from your traefik instance, but how do I route the prometheus traffic to the Traefik pod itself when both prometheus and Traefik are within the cluster? Just use a ClusterIP k8s service, I would think, but I'll see if that works.

@Adam-D-Lewis
Copy link
Member Author

From stackoverflow, For automatic discovery of a pod, this is needed in the kubernetes configuration:

- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
    action: keep
    regex: true
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
    action: replace
    target_label: __metrics_path__
    regex: (.+)
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
    action: replace
    regex: ([^:]+)(?::\d+)?;(\d+)
    replacement: $1:$2
    target_label: __address__

@Adam-D-Lewis
Copy link
Member Author

I was able to get this working using a helm chart (see prom_values.yaml in https://github.com/Quansight/grafana-prometheus-qhub). Next, I just need to transfer the prom_values.yaml file into the terraform format in qhub/qhub/template/{{ cookiecutter.repo_directory }}/infrastructure/modules/kubernetes/services/monitoring/main.tf.

@Adam-D-Lewis
Copy link
Member Author

Adam-D-Lewis commented Aug 30, 2021

Alright so the prometheus_grafana branch sets up traefik as a prometheus target correctly now. The dashboard still needs to be added.

@Adam-D-Lewis
Copy link
Member Author

Adam-D-Lewis commented Aug 30, 2021

We can add a grafana dashboard via a configmap or a secret. Now I need to determine which dashboard we want added or make a sensible dashboard then define the configmap in terraform. I've committed a sample configmap to the prometheus_grafana branch to document the work so far.

@costrouc
Copy link
Member

Thanks @Adam-D-Lewis. Would you mind turning this into a PR? I'd like to review it and be able to merge it before you get too busy with other projects.

@costrouc
Copy link
Member

@tylerpotts schedule a time to sync up with @Adam-D-Lewis to pick up this issue.

@Adam-D-Lewis Adam-D-Lewis linked a pull request Aug 31, 2021 that will close this issue
@Adam-D-Lewis Adam-D-Lewis linked a pull request Aug 31, 2021 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement 💅🏼 New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants