Beautiful Dashboards with Grafana and Prometheus - Monitoring Kubernetes Tutorial

Поділитися
Вставка
  • Опубліковано 13 лип 2024
  • Grafana and Prometheus are a powerful monitoring solution. It allows you to visualize, query, and alert metrics no matter where they are stored. Today, we'll install and configure Prometheus and Grafana in Kubernetes using kube-prometheus-stack. By the end of this tutorial you be able to observe and visualize your entire Kubernetes cluster with Grafana and Prometheus.
    Video Notes: technotim.live/posts/kube-gra...
    A HUGE thanks to Datree for sponsoring this video!
    Combat misconfigurations. Empower engineers.
    www.datree.io
    Don't want to host it yourself? Check out Grafana Cloud and sign up for a free account l.technotim.live/grafana-labs
    Set up Kubernetes, fast and automated! • The FASTEST Way to run...
    Support me on Patreon: / technotim
    Sponsor me on GitHub: github.com/sponsors/timothyst...
    Subscribe on Twitch: / technotim
    Become a UA-cam member: / @technotim
    Merch Shop 🛍️: l.technotim.live/shop
    Gear Recommendations: l.technotim.live/gear
    Get Help in Our Discord Community: l.technotim.live/discord
    2nd channel: / @technotimtalks
    (Affiliate links may be included in this description. I may receive a small commission at no cost to you.)
    00:00 - What is Prometheus and Grafana
    01:52 - Ad: Datree - Prevent Kubernetes Misconfigurations
    03:05 - Prometheus Requirements
    05:41 - Create a Namspace
    06:22 - Installing with Helm and Using Values
    09:12 - Alert Manager Helm Values
    10:34 - Grafana Helm Values
    11:30 - Helm Values for k3s Server
    12:30 - Overriding and Relabeling with Helm
    13:18 - Storage Class with Helm
    15:22 - Creating Kubernetes Secrets for Grafana
    17:30 - Installing Prometheus Stack
    19:16 - Port Forwarding to Grafana with Kubernetes
    20:58 - Exploring Charts in Grafana
    23:37 - My Home Production Cluster Metrics
    26:58 - Stream Highlight: "Chat tries to get me to speak German"
    #grafana #prometheus #kubernetes
    Thank you for watching!
  • Наука та технологія

КОМЕНТАРІ • 120

  • @TechnoTim
    @TechnoTim  2 роки тому +15

    Have you set up monitoring yet?

    • @leonardotoschi585
      @leonardotoschi585 2 роки тому +1

      I use remote proxmox for monitoring

    • @ytuser13082011
      @ytuser13082011 2 роки тому

      Yes, right now thanks to your help! maybe you can also show how to add physical machines to this Prometheus Stack, so they can also get monitored?

    • @JerryGoNuts
      @JerryGoNuts 2 роки тому +1

      Fantastic. I have a question. Have you ever created a K3s pod running Docker, and then run Docker inside that Docker pod??? I'm trying to figure that out.

    • @andrusaren8348
      @andrusaren8348 2 роки тому

      I have Rancher installed and monitoring enabled.

    • @MadChristianX
      @MadChristianX Рік тому

      I really love your videos and appreciate your work. Using your Grafana-Loki setup to monitor my main traefik reverse proxy secured with crowdsec. Just set up a matrix synapse homeserver for my friends just behind it.

  • @epochphilosophy
    @epochphilosophy 5 місяців тому +3

    Actually mind blowing how easy you make these things, whereas I was to do this on my own it would take me weeks! Thanks so much for your work.

  • @DamjanKumin
    @DamjanKumin 2 роки тому +2

    Tim, another “old school” video that is just fantastic! Keep it up :) ⭐️

  • @marwanfikrat7716
    @marwanfikrat7716 Рік тому

    This is really good. To the people who made Prometheus, to the implementers of helm and then the charts and finally you I can very easily get up and running. Thank you! Subscribed :))

  • @NarendraChennamsetty
    @NarendraChennamsetty Місяць тому

    Incredible tutorial..this is exactly what I was looking for. Subscribed!

  • @liamhardman875
    @liamhardman875 2 роки тому

    Brilliant timing, just set up my own GKE Autopilot cluster a couple days back and wanted to implement and document monitoring!

  • @omarlittle5802
    @omarlittle5802 2 роки тому

    YEEEEEEES Tim! I've been waiting for you to cover this!!

  • @lightyagami0ben
    @lightyagami0ben 7 місяців тому

    Thanks for the great content Tim, your videos help me a lot at my work !!

  • @patrickmartins1925
    @patrickmartins1925 Рік тому +2

    This channel is fantastic! Thanks Tim for the great content.

  • @kaitlynk2145
    @kaitlynk2145 2 роки тому +2

    Great video always love tutorials thanks for all you do

  • @cyber-paul
    @cyber-paul Рік тому

    [REDACTED] Great detailed walk-through Tim. Thanks so much.

  • @nataliekruck810
    @nataliekruck810 Рік тому +3

    Hey Tim, your videos are so great! Keep up this amazing work!
    Ps: I would love an video on deploying gitlab. Seriously struggling 😅

  • @azr_sd
    @azr_sd 2 роки тому

    looking exactly for this!! thanks

  • @drystack86
    @drystack86 11 місяців тому +1

    Great video. You might want to consider advertising in the title that you are specifically working with the kube-prometheus-stack. This is a very powerful approach and I think it would great if your video title had some reference to that.

  • @barryx-simten1119
    @barryx-simten1119 Рік тому

    Well done! Thank you Tim.

  • @Bear-form
    @Bear-form 2 роки тому

    Very good. I had issues implementing it before

  • @avivlevi1055
    @avivlevi1055 Рік тому

    Super helpful video thank you !

  • @dh2-io
    @dh2-io 2 роки тому +1

    As always a great video! I had planed to setup the same thing you did in the vid, a bit over two weeks ago, but my laptop broke and now I have to get it repaired or a new one.
    #100daysofhomelab keep going

  • @filiecs3
    @filiecs3 Рік тому

    Your talk of deleting secrets from the Yaml file reminded me that I recently solved this problem in my Kubernetes cluster.
    Using Hashicorp-Vault paired with another project called External Secrets, I am able to automatically pull my secrets from Vault and inject them into my applications automatically.
    You should do a video on that so that people don't risk keeping all their secrets in source control or on the host.

  • @LampJustin
    @LampJustin 2 роки тому +10

    25:00 Correction: It is a statefulset ;) Statefulsets always get created with a normal name and a number at the end. Replicasets in contrast get created by deployments and always have some random stuff at the end. Otherwise great video!

    • @TechnoTim
      @TechnoTim  2 роки тому +4

      Thank you! I added a caption but it was small and hard to see!! Good call!

  • @himanshuvishwakarma1521
    @himanshuvishwakarma1521 9 місяців тому

    Thanks It Works.

  • @scigama71
    @scigama71 Рік тому

    i really liked the intro... subbed :)

  • @Subbeh2
    @Subbeh2 Рік тому

    Great stuff as always. Just checking where I can find the YAML file to edit the extra_server_args as mentioned in the video if you don't want to go the ansible route?

  • @qzorn4440
    @qzorn4440 Рік тому

    Wow. Looks like a good project for the Orange Pi5? 😎 Thank you.

  • @minecraftbuildingtips
    @minecraftbuildingtips 6 місяців тому

    Great video series! Question: what would be the proper way to add additional extra_server_args to a K3s cluster setup with your playbook?

  • @RichDurso
    @RichDurso 2 роки тому +1

    Tim, you talked about relabeling a bit in the config section but didn't see you cover what they did in the demo. I tried the labels you used as-is, and nothing changed. However, instead of "targetLabel: kubernetes_node" I tried "targetLabel: instance" and then some dashboards started changing instance IP address to node name. I'm using K3s with contrainerD (no docker).

  • @robmit4020
    @robmit4020 Рік тому

    Tim great video
    Can you share a sample yaml for the ingress on grafana, prometheus and alert manager to use and expose access
    Thank you

  • @omarlittle5802
    @omarlittle5802 2 роки тому

    Thanks

    • @TechnoTim
      @TechnoTim  2 роки тому +2

      Wow! Thank you so much!!!

  • @jart122
    @jart122 Рік тому

    Can you please create a video on how to monitor cpu temperatures in proxmox with dual Xeon processors. Thank you.

  • @kriswachtell
    @kriswachtell 7 місяців тому +2

    Hi Tim! Your videos are great!
    In my cluster the values.yaml file, unfortunately, results in the prometheus-prometheus-prometheus-0 pods continuing to crash (error log: "parsing YAML file /etc/prometheus/config_out/prometheus.env.yaml: empty duration string". It's very likely that because of a difference between the version of the CRDs and the operator version (e.g. operator version > CRD version). In my case it got solved by adding the following to the values.yaml file:
    prometheus:
    prometheusSpec:
    scrapeInterval: 30s
    evaluationInterval: 30s

  • @kishoresharma1130
    @kishoresharma1130 Рік тому +1

    Hi , Thanks for the awesome video. Can you please share the dashboard Json which you showed in the video . That looks good. If you have that dashboard custom JSON was placed in your GitHub pls share and looking for kubernests pod specific and cluster specific dashboard

    • @TechnoTim
      @TechnoTim  Рік тому +1

      It's included when you install this helm chart!

  • @subzizo091
    @subzizo091 9 місяців тому

    hello , thanks Tim for the great content, please how to pass the extra args if the cluster is already up "how to update it in a yaml file " , thanks again

  • @benjamintischlak1951
    @benjamintischlak1951 Рік тому +1

    Hey Tim, nice Video! I`ve got a short question: Do you know if there is a script from Proxmox Helper Scripts for this setup? This would be very useful if there is a one command in the node shell posibility. best regards, Benjamin

    • @TechnoTim
      @TechnoTim  Рік тому +1

      Thank you! This Ansible playbook will set up k3s for you in a few minutes! ua-cam.com/video/CbkEWcUZ7zM/v-deo.html

    • @benjamintischlak1951
      @benjamintischlak1951 Рік тому

      @@TechnoTim You rock 👌👍 thx

  • @MinhNguyen-mb9of
    @MinhNguyen-mb9of Рік тому

    any idea on how to import wmi importer metrics to prometheus targets ?

  • @sonubhagat6372
    @sonubhagat6372 10 місяців тому

    Could you please make a detailed video on small step ca on kubernetes. For self singed certificate

  • @user-vm2ik5tf6v
    @user-vm2ik5tf6v Місяць тому

    Where can we find the values.yaml file you created? Seems to be working just fine for my needs

  • @UntouchedWagons
    @UntouchedWagons 8 місяців тому

    Tim did you ever make the alerts video?

    • @TechnoTim
      @TechnoTim  8 місяців тому

      Unfortunately not yet! AlertManager is wildly complex!

  • @stefanopucci6313
    @stefanopucci6313 Рік тому

    my question is : can i get this on proxmox lxc container ? some guides or video ?

  • @dmcg7900
    @dmcg7900 Рік тому

    Is there a dashboard that includes CPU temp (I’m running a raspberry pi cluster)?

  • @trevorrydalch8959
    @trevorrydalch8959 Рік тому

    You have several videos on setting up and using rancher, I'm curious why you've started using Lens. Do you still use Rancher? What led you to start using Lens and what do you like more about it?

    • @TechnoTim
      @TechnoTim  Рік тому +1

      I do still use rancher and love it! Use Lens sometimes at work and other clusters where Rancher is not managing them!

    • @trevorrydalch8959
      @trevorrydalch8959 Рік тому

      @@TechnoTim I'll have to check out Lens! Thanks for the reply.

    • @trevorrydalch8959
      @trevorrydalch8959 Рік тому

      I set up an ingress and then set replicas for grafana to 2 and then brought a node down (to simulate failover). It didn't handle it well. Lost some custom panels I had put together. Any chance you could do a video on HA grafana?

  • @cannfoddr
    @cannfoddr Рік тому

    I have watched your video and read the docs - I am not clear what needs to be done with the extra_server_args. I have an existing cluster built with your ansible. I COULD reset it and add the extra args to the ansible variables and start over. However I have done quite a bit to the server and would then need to recover everything all over again. You mention that these can be added to a server configuration and the services restarted but I cannot find where you cover that route?

    • @bluesquadron593
      @bluesquadron593 10 місяців тому

      I have just re-ran the deployment over the old one. Seemed to work…

  • @bastooopanooo2311
    @bastooopanooo2311 Рік тому

    Same can done using Java Melody.

  • @ytuser13082011
    @ytuser13082011 2 роки тому +16

    People who wrote Prometheus are sadists, just like those who wrote NixOS. Documentation is convoluted and filled with overcomplicated terms and more often than not it does not make any sense. I'm in IT field for well over 20 years now and I rarely see such a disaster. Thanks Tim for helping us to get our heads around such unapproachable and badly documented piece of software.

    • @notmything6629
      @notmything6629 2 роки тому

      I completely agree. But it happens a lot with already well known open source projects that are also used by enterprises

    • @szymonsko6302
      @szymonsko6302 2 роки тому

      Totaly agree :D I just handle by my own pain to setup demo with HA prometheus with thanos with 3x receivers "push" model :)

    • @TechnoTim
      @TechnoTim  2 роки тому +2

      😂. Thank you!

  • @shouryashrivastava3948
    @shouryashrivastava3948 2 роки тому

    Can you Make a updated video on setting up k3s on home-lab.

    • @TechnoTim
      @TechnoTim  2 роки тому +1

      Already did! ua-cam.com/video/CbkEWcUZ7zM/v-deo.html

  • @giuseppebinetti87
    @giuseppebinetti87 Рік тому

    I have already a Grafana instance running, is it possible to send all the metrics to that and import the dashboards to that instance?

    • @TechnoTim
      @TechnoTim  Рік тому +1

      Yup, sure with a little config!

  • @JakeSchweihs
    @JakeSchweihs Рік тому

    I got this setup in my Kubernetes cluster on AWS (EKS) and it seems to be working well except I do not see any data in my etcd Dashboard.
    I changed the 'endpoints' to be the private IPs of my nodes in my cluster.
    Is it possible that this is just a limitation of using the AWS hosted cluster? or is there any other config worth investigating?
    Thanks.

    • @TechnoTim
      @TechnoTim  Рік тому

      It’s likely. AWS may not expose those endpoints on etcd nodes.

    • @JakeSchweihs
      @JakeSchweihs Рік тому

      @@TechnoTim You got a sub for giving me the quickest reply in YT tutorial history. Thanks.

  • @swaroopkumarkondreti5299
    @swaroopkumarkondreti5299 Рік тому +1

    values.yaml file missing where can i get ?

  • @WeAreTheTENDERS
    @WeAreTheTENDERS Рік тому

    Song ID in the beginning? :P

  • @SumitPal-bs7cu
    @SumitPal-bs7cu Рік тому

    Hi, Can you please share the grafana dashboard id you used in this video?

    • @TechnoTim
      @TechnoTim  Рік тому

      It's in the docs link and ships with this chart!

  • @saintnoahl
    @saintnoahl Рік тому

    How come I don’t see those automatically generated dashboard?

  • @Davidlavieri
    @Davidlavieri 3 місяці тому

    It's feature complete but i find it extremely bloated even when turn off a bunch flags

  • @peterdedene
    @peterdedene 2 роки тому

    What is your terminal font?

    • @TechnoTim
      @TechnoTim  2 роки тому +2

      Default zsh terminal theme!

  • @szymonsko6302
    @szymonsko6302 2 роки тому

    What about HA on this setup ?

    • @TechnoTim
      @TechnoTim  Рік тому +1

      just increase the replicas and you have HA

  • @pausanchezv
    @pausanchezv 10 місяців тому

    Hey yo! Tutorial's good but where's the values.yaml? Can't find it!

    • @TechnoTim
      @TechnoTim  10 місяців тому

      It's on my docs site, just search my site for the title name!

    • @pausanchezv
      @pausanchezv 10 місяців тому

      @@TechnoTimThanks, I have one last question. I have my cluster on GCP, so the master nodes are kinda opaque to me. I cannot get the IPs the way you do and paste them in the values file. I'm just omitting the IPs part. Would that be correct? Thanks :)

  • @nlahmi
    @nlahmi 2 роки тому

    Can you share your short values.yaml file? Thanks!

    • @TechnoTim
      @TechnoTim  2 роки тому +2

      I did! It’s in the docs linked in the description!

    • @stevemulcahy5014
      @stevemulcahy5014 Рік тому

      @@TechnoTim I don't seem to see the link for the docs in the description...

  • @admun
    @admun Рік тому

    Nice tuning to the values.yml! I am using kube-prometheus-stack too for my new rke2 cluster. I deploy it with fluxCD

  • @MrEric377
    @MrEric377 2 роки тому

    Are there alerts for expiring certificates? Lol, personal problems.

    • @TechnoTim
      @TechnoTim  2 роки тому +2

      Asking for a friend 😀

  • @MokshaDharma
    @MokshaDharma Рік тому

    When joining Mastodon?

  • @altverskov
    @altverskov Рік тому +2

    You forgot to post your values.yaml :(

  • @r351574nc3
    @r351574nc3 9 місяців тому

    Left out crds from video

  • @xamindar
    @xamindar Рік тому

    Wow this thing murdered my 5 pi4 cluster. Kubectl couldn't even reach it anymore. Pretty awful set of tools if they require that much resources.

    • @TechnoTim
      @TechnoTim  Рік тому

      Sorry, but it’s a pretty standard monitoring stack for k8s!

    • @xamindar
      @xamindar Рік тому

      @@TechnoTim I guess just not for k3s on top of raspberry pis.

    • @xamindar
      @xamindar Рік тому

      @@TechnoTim And I didn't mean to be rude or anything. You made a great tutorial and explained everything very clearly. Thank you.

    • @TechnoTim
      @TechnoTim  Рік тому

      Not at all! I didn't take it that way! Pis are great for learning clustering but stumble when it comes to common workloads!

  • @wva5089
    @wva5089 2 роки тому +3

    Thanks for your videos.
    your password file idea is bad..your bash history AND your filesystem now have that password.
    one solution is to use environment variables.
    read -p "enter password:";
    kubectl create secret generic mysecret --from-literal="admin-user=adminuser%" --from-literal="admin-password=$REPLY"
    or slightly more succinct:
    kubectl create secret generic mysecret --from-literal="admin-user=$(read -p user:;echo -n $REPLY)" --from-literal="admin-password=$(read -p "password:";echo -n $REPLY)"
    Thanks again for your videos.

    • @TechnoTim
      @TechnoTim  2 роки тому +2

      Thanks for the tip! Agreed, there are many ways to do this!

    • @RichDurso
      @RichDurso 2 роки тому

      @@TechnoTim The echo commands you did will be in your history. With Bash, start any command line with a space and it will not be added to your command history file (typically enabled). You can do " echo hi" (no actual quotes) and press up arrow for last command.... its not there. ZSH needs "setopt HIST_IGNORE_SPACE" set to work.

  • @christianleicht7973
    @christianleicht7973 Рік тому +1

    Grafana is slow slow slow

  • @santacloudy
    @santacloudy 6 місяців тому

    wtf is all this, jeez

  • @rabhiff
    @rabhiff 2 роки тому

    I think kubernetes sucks because it has built in Google metrics and it won't work in air gapped envs etc.

    • @TechnoTim
      @TechnoTim  Рік тому +1

      not sure what you mean? k3s doesn't have anything built in from Google, well, except for the fact that it was built by Google but all proprietary code is stripped out

    • @rabhiff
      @rabhiff Рік тому

      @@TechnoTim Hello Tim,
      I like your channel a lot. I meant Redhat based envs and native Kubernetes.
      You are right K3, Openshift and Tanzu works in air-gapped hardened enviroments.
      There are a lot pitfalls in docker and kubernetes, I personally prefer pure vms.
      Persistence, Timezones(logs), host swapping issues(docker), complexity(microservice envs kubernetes) etc.

    • @rabhiff
      @rabhiff Рік тому

      I mean UTC clock in logs is petty hard sometimes..

  • @rog33ful
    @rog33ful Рік тому

    Tim, helm install prometheus prometheus-community/kube-prometheus-stack # is not working..

    • @bluesquadron593
      @bluesquadron593 10 місяців тому

      Did you manage to solve the issue, it didn’t work for me either. In fact it crashed my cluster…

  • @grencez
    @grencez 2 роки тому +1

    now i can get paged from home too 🥲

    • @TechnoTim
      @TechnoTim  2 роки тому +1

      🤣

    • @rog33ful
      @rog33ful Рік тому

      @@TechnoTim helm install prometheus prometheus-community/kube-prometheus-stack # is not working..(Install failed). Can you pls verify. I am wondering if something needs to be done on microk8s. It worked before on one of the other machines a month ago.