Introduction to the Prometheus Operator on Kubernetes

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ส.ค. 2024
  • Subscribe to show your support! goo.gl/1Ty1Q2 .
    Patreon 👉🏽 / marceldempers
    Today we're going to explore the Prometheus Operator.
    This makes it easier to deploy and manage Prometheus instances on Kubernetes. You can have dedicated instances to monitor specific types of workloads and create an awesome decentralized monitoring platform.
    Also if you want to support the channel further, become a member 😎
    marceldempers.dev/join
    Checkout "That DevOps Community" too
    marceldempers.dev/community
    Follow along with the source code below
    Source Code
    github.com/marcel-dempers/doc...
    Also, if you're new to Kubernetes, checkout my guides below:
    Check out part 1 for how to install Kubernetes on Windows:
    • Kubernetes Getting Sta...
    Check out part 2 of how to use KUBECTL:
    • Kubectl basics for beg...
    Check out part 3 of how to do deployments
    • Kubernetes Deployments...
    Check out part 4 of how to manage application configurations
    • Configuration manageme...
    Check out part 5 of secret management explained
    • Kubernetes Secret Mana...
    Like and Subscribe for more :)
    Follow me on socials!
    Patreon | / marceldempers
    Twitter | / marceldempers
    GitHub | github.com/marcel-dempers
    Facebook | thatdevopsguy
    LinkedIn | / marceldempers
    Instagram | / thatdevopsguy
    Music:
    Track: E's Jammy Jams - We Wish You a Merry Christmass (Jazz)
    Track: Puar - GEMS W/ sin
    Listen: / gems-w-sin
    Track: Polaroid Papi - tha bag
    Listen: / tha-bag
    License: creativecommons.org/licenses/...
    Track: Prod. Mesio - In Justice
    Listen: / suicide-boys-x-pouya-x...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 78

  • @TiferetJackson
    @TiferetJackson 8 หลายเดือนก่อน +3

    This is soo helpful!!! I've been struggling for a while now trying to understand operators and how they work... Thank you so so much! 😊😊

  • @viktorgadachek3933
    @viktorgadachek3933 4 ปีที่แล้ว +2

    Great work man! Just keep releasing new videos and your channel will be getting more popular. Marry Christmas and good luck!

  • @pedronascimento3094
    @pedronascimento3094 4 ปีที่แล้ว +4

    I love your videos because a learn to use tools with a real-world approach. Thanks to sharing you Knology.

  • @exit-zero
    @exit-zero 4 ปีที่แล้ว

    Merry Christmas Marcel, nice video, such Prometheus helps DevOps have a better holiday, lol.

  • @amanmahajan4538
    @amanmahajan4538 2 ปีที่แล้ว +1

    Thanks for making these videos. Very helpful! :)

  • @abdulali7692
    @abdulali7692 4 ปีที่แล้ว +1

    Excellent explanation....was struggling a alot now cleared all my doubts....pls make a video for the same using helm chart pls make it soon

  • @Abdullah32066
    @Abdullah32066 3 ปีที่แล้ว

    Thanks a lot! Your videos are amazing. Liked all of them.
    I haven't found any good video about RBAC. Please make one!

  • @varunjain3870
    @varunjain3870 4 ปีที่แล้ว +1

    Great content. Keep it up! Thanks!

  • @whyismychannelhandletaken
    @whyismychannelhandletaken 4 ปีที่แล้ว +9

    Holy smokes, I have been struggling with grasping the stable/prometheus-operator helm deployment. 40K lines of yaml for us. This made it all clear, thank you!

    • @MarcelDempers
      @MarcelDempers  4 ปีที่แล้ว +6

      I would stay clear of stable helm upstream charts. They're great to study implementation details, however they are super over-engineered, hide things they install on your cluster and also make it nearly impossible to upgrade components later down the track. Prometheus eco-system changes too often and doing diff's between charts a few months apart is a nightmare. My DevOps top tip = "Keep it Simple" :)

    • @cokegen
      @cokegen 3 ปีที่แล้ว +1

      @@MarcelDempers true true ... been there ...

  • @Misterad13
    @Misterad13 3 ปีที่แล้ว

    Thx for the explanations ! Congratz !

  • @gadeichhorn
    @gadeichhorn 2 ปีที่แล้ว

    very clearly explianed, thank you!

  • @skchang2239
    @skchang2239 ปีที่แล้ว

    really useful video, helps a lot! Thanks you!

  • @vikashkaushik1557
    @vikashkaushik1557 ปีที่แล้ว

    Very helpful, thanks!

  • @oussamamechlaoui174
    @oussamamechlaoui174 3 ปีที่แล้ว +4

    Very interesting content, thanks for this lecture! 5* feedback.

  • @tarunprakash2590
    @tarunprakash2590 4 ปีที่แล้ว +4

    @Marcel If i may request - i am currently evaluating `Integrating Thanos with prometheus operator" to solve known problems associated with prometheus.
    > Global Query
    > Longer Retention
    > HA
    If you could explore that option and extend this prometheus operator series. Thank you :)

  • @duhhhbruhh3042
    @duhhhbruhh3042 4 ปีที่แล้ว

    legendary video

  • @OfficeNothanks
    @OfficeNothanks 3 ปีที่แล้ว

    Can you use the Prometheus operator to monitor for example barebones machines running node exporter on them?

  • @satishkad1804
    @satishkad1804 2 ปีที่แล้ว

    Do you have anything on getting spark application metrics using prometheus?

  • @Punjab_the_land_of_five_rivers
    @Punjab_the_land_of_five_rivers 4 ปีที่แล้ว

    Hello sir , i got stuck in helm chart of prometheus-operator. In my project i deployed my php application under kube-system namespace. And install the prometheus operator helm chart under the monitoring namespace. Now i want to monitor my application (not the nodes and kube-system just the applications). What will be the direction path for it?

  • @tadeubernacchi3360
    @tadeubernacchi3360 ปีที่แล้ว +1

    Nice video man - What do you mean on 9:35: "Now you can go ahead and create as many prometheus instances as we wanted" - "This is completely up to you how you want to design this" - Did you install the Operator right? Now I need to install a new prometheus deployment in every namespace where I want to monitor? Is that is? How can I install the Prometheus in the k8s cluster where I can monitoring everything that's running in there? Thanks again!

    • @MarcelDempers
      @MarcelDempers  ปีที่แล้ว +1

      My How to monitor Kubernetes in 2022 video covers this 👍🏼💪🏽
      Yes, you use the operator.

  • @zaheerhussain5311
    @zaheerhussain5311 3 ปีที่แล้ว

    Hi
    Nice explanation. Do you share deployment of prometheus operator using dynamic provision storage.
    Regards
    Zaheer

  • @bronsonvandrades
    @bronsonvandrades 3 ปีที่แล้ว

    Is there any document for Prometheus to start from scratch?
    i mean i have knowledge on Kubernetes now since i have CKA exam completed.
    I need to know how to install Prometheus on nodes exactly do we need to install on master node or worker node?
    or we need separate node to get Prometheus installed?
    from this videos i understood that Prometheus is a tool which i will pull the metrics logs from the kubernetes objects and then we need some visualization tools like Graphana to display the logs pulled by Prometheus
    do we need lots of storage space to get these logs stored ?

  • @68naveeng
    @68naveeng 3 ปีที่แล้ว

    Hi
    Could you plz guide us to install snmp exporter in kubernetes

  • @rajeevghosh2000
    @rajeevghosh2000 3 ปีที่แล้ว +1

    Thanks for the great video. can i ask a quick question. Does prometheus pulls the metrics directly from the containers/pods ? it doesnot need cadvisor ? Also, if I understood correctly, prometheus pulls the metrics using http . Does it mean every container should listen to HTTP requests from prometheus ?

    • @MarcelDempers
      @MarcelDempers  3 ปีที่แล้ว +1

      For container level performance metrics, they are exposed by the kubelet's cAdvisor endpoint and scraped by Prometheus. Similar metrics come from the kube-state-metrics server as well.
      You only need to expose HTTP endpoint on your service if you have custom application metrics that you want to grab and then you'd use a ServiceMonitor to scrape those

  • @georgelza
    @georgelza 3 ปีที่แล้ว

    executed the operator directory... had errors, did a tear down, is there a order in which i can execute the yaml files manually, after having created the namespace.

  • @korbkrys5868
    @korbkrys5868 2 ปีที่แล้ว

    Can you do a video on the crunchy Postgres operator or Zalando operator?

  • @jayeshthamke7860
    @jayeshthamke7860 4 ปีที่แล้ว +1

    Great material! How to aggregate the metrics if we have multiple Prometheus instances running into cluster? And can we aggregate metrics from k8s multi-cluster may be deployed in Gardner?
    Thanks in Advance.

    • @MarcelDempers
      @MarcelDempers  4 ปีที่แล้ว +1

      Thank you for the kind words 🤓 There are a few approaches you could take. If you are running multiple prometheus instances you can either replicate the data to a central prometheus instance by using the /federate API. Prometheus instances can scrape each other to move data out to a central one for dashboarding.
      Another approach is have every prometheus instance push its metrics out to a central storage using the "remote-write" feature. You can then use that data store as a data source for dashboarding. Hope that helps 💪🏽

    • @tarunprakash2590
      @tarunprakash2590 4 ปีที่แล้ว

      Thanos querier component is exactly designed to do - merge and deduplicate similar metrics. Visit thanos.io to know more

  • @bryanmonsalvatge1696
    @bryanmonsalvatge1696 4 ปีที่แล้ว +2

    How do you recommend exposing this service so that it can be added as a data source to Grafana in a different k8s cluster?

    • @MarcelDempers
      @MarcelDempers  4 ปีที่แล้ว +1

      There are a number of ways you can achieve this. a) Expose Prometheus using an ingress over TLS and something like basic authentication with IP restriction can help. b) Use Prometheus federation to move data to a local Prometheus grafana can connect to. Federate endpoints can also be protected by an ingress controller. c) Another method ive come to learn about is Remote write. Prometheus instances can write data out to an external endpoint in your grafana cluster. This may help reduce number of exposed endpoints you have to protect. Hope this helps 💪🏽

  • @SteelerLemon0
    @SteelerLemon0 4 ปีที่แล้ว +1

    How do you add Kube state metrics to Prometheus with this set up?

  • @DiscoDaveDance
    @DiscoDaveDance 4 ปีที่แล้ว

    Great video. But wearing an Arch Linux T-shirt whilst recording on Windows? :D

  • @DrBustenHalter
    @DrBustenHalter 4 ปีที่แล้ว

    Like your style! If we have multiple replicas of prometheus in a deployment, for resilience.. they will double-up the same stats and network iops? Do you recommend only 1 prom pod per deployent / stateful set? Have you tried the stable/prom-operator helm that bundles grafana, kube-state-metrics, etc..? it looks good but seems to run 1 prometheus that pulls in everything in that infrastructure scope. I guess you extend it per your example here .. and add that new prom service DB / datasource to grafana? A lot is not transparent in the helm deployments... quick but you lose control.

    • @MarcelDempers
      @MarcelDempers  4 ปีที่แล้ว

      One thing to note is that Prometheus architecture has high availability in mind.
      You dont need many instances scraping the same targets. What I would recommend is perhaps
      slicing it up to where you have 1 instance per subset of targets. Like 1 that looks after node-exporter.
      Perhaps 1 that is dedicated to kube-state-metrics, 1 for API server, something along those lines.
      By distributing the responsibilities of Prometheus, you get improved resilience.
      Same goes for 1 prometheus per group of micro services.
      Another thing to note is that if prometheus is down, you persist data on something like a persistent volume (statefulset). You won't lose metrics. As long as Prometheus comes up in time it will rescrape and continue to collect stats that may have been missed during downtime.
      You can also increase availability by federating all the instances data across to other Prometheus instances with the /federate endpoint.
      Dashboards can point to a federated copy too, increasing resilience even more.
      Prometheus is complex, but extremely flexible and the above statements make it very resilient, when setup with availability in mind.

    • @DrBustenHalter
      @DrBustenHalter 4 ปีที่แล้ว

      @@MarcelDempers Thanks for the reply!! I agree. I was working with the helm stable/prometheus-operator which comes with a load of useful stuff to get you up and running (Alertmanager, Grafana with Dashboards, all the K8 infrastructure ServiceMonitors, etc). I was worried it wouldn't be modifiable - but you can add a new Prom instances the way you show here for the application layer etc. You can even move off kube-state-metrics, etc to dedicated promethei too if that 1 instance gets too big. Persistence works fine and new prom's all get added as stateful sets. I just create a new grafana data source as they get added. So it's just a helm release with a few patches applied to customise it... very cool!! Looks like I've done a month of work 😆👍

  • @iposipos9342
    @iposipos9342 2 ปีที่แล้ว

    Hi, thanks for the nice video. i have a question. if after setting up Prometheus for my cluster, i later on added decided to scale my cluster by adding new VMs, will the existing node exporter pick the metrics for the new VMs? or will i have to configure the node exporter for the new VMs? Thank you

    • @MarcelDempers
      @MarcelDempers  2 ปีที่แล้ว

      node-exporter should be running as a daemonset, so it will scale to the new machines when they start up

    • @iposipos9342
      @iposipos9342 2 ปีที่แล้ว

      @@MarcelDempers okay, thank you

  • @prasantcr
    @prasantcr 3 ปีที่แล้ว

    I have a question, can we edit the prometheus.yaml file, I mean the configuration file. not the one that is in the repository. If yes how can we do that..?

    • @MarcelDempers
      @MarcelDempers  3 ปีที่แล้ว

      The Prometheus CRD provides the interface to configure prometheus so you dont have to touch and manage the underlying configuration. ServiceMonitors are also an interface to this.
      You can check the docs here github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#prometheusspec

    • @prasantcr
      @prasantcr 3 ปีที่แล้ว

      @@MarcelDempers So how do I edit the present configuration of the current scrape configuration. ?

  • @andrewfigaroa7031
    @andrewfigaroa7031 2 ปีที่แล้ว

    This works for me to get things installed, but how do I add my targets (my custom Apps)? I know with prometheus VM I populate my static_configs in /etc/prometheus/prometheus/prometheus.yml file. but I have no clue how to accomplish this with the helm approach. Also, I have not been able to locate any documentation on how to do this.

    • @MarcelDempers
      @MarcelDempers  2 ปีที่แล้ว +1

      Got two videos coming soon that address this. You want to learn about Service monitors

    • @andrewfigaroa7031
      @andrewfigaroa7031 2 ปีที่แล้ว +1

      @@MarcelDempers awesome! Thanks

  • @Fidellio369
    @Fidellio369 6 วันที่ผ่านมา

    Can you speak of the Thanos sidecar and other Thanos services offered with the Prometheus operator?

  • @ankitagarwal6014
    @ankitagarwal6014 4 ปีที่แล้ว

    i am a devops fresher and i have just come across prometheus and grafana. is there any step by step learning video on these technologies?

    • @MarcelDempers
      @MarcelDempers  4 ปีที่แล้ว +1

      Nice! Welcome, here is a playlist with step by step content and source code th-cam.com/play/PLHq1uqvAteVuEXCrRkPFWLXRKWNLOVUHn.html
      💪🏽

    • @ankitagarwal6014
      @ankitagarwal6014 4 ปีที่แล้ว

      @@MarcelDempers thanks 😊..also can you make some videos on managed services offered by cloud providers like EKS and AKS?

  • @gouterelo
    @gouterelo 4 ปีที่แล้ว

    Hello Marcel, great videos in your channel and great you have a series of prometheus and grafanna !!! One question, i try to apply your yamls and i get this error... error: unable to recognize "service-monitor.yaml": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
    I guess it will be the version of my k8s cluster (18.0)... !! Greetings from argentina :D !
    I deploy it again after all deploy and it deploy it well... depends of the cluster speed to create all the instances :D !

    • @MarcelDempers
      @MarcelDempers  4 ปีที่แล้ว +1

      Thanks mate💪🏽 Just a notice, the prometheus operator needs to be running first. When it runs, it creates the servicemonitor CRDs so that you can apply the service monitor. You can only apply the service monitors once the operator has initialized properly 🤓If you apply all the YAML files too fast, the ServiceMonitor CRD will not have been created and you will face that error. hope that helps

    • @gouterelo
      @gouterelo 4 ปีที่แล้ว

      @@MarcelDempers Thanks for the advice Marcel ! another question... i have problems to scrape kubelet if i deploy all your yamls... and i cant found where the error is, i think because your yamls are for minikube ? i deploy a k8s HA cluster on prem... cheers !!

  • @chasim1982
    @chasim1982 4 ปีที่แล้ว

    Really Nice explanation, I am getting this error ---> error: unable to recognize "service-monitor.yaml": no matches for kind "servicemonitor.monitoring.coreos.com" in version "monitoring.coreos.com/v1"

    • @MarcelDempers
      @MarcelDempers  4 ปีที่แล้ว +1

      Thank you 💪🏽
      Older version of the operator will create the CRDs for service monitors automatically when starting up. Once the operator is running you can retry adding service monitors.
      OR - You can deploy the CRD's separately like I do in this video th-cam.com/video/abq-6FBn0fo/w-d-xo.html

  • @georgelza
    @georgelza 3 ปีที่แล้ว

    ... the prometheus-operator directory does not seem to be part of your directory structure anymore ?

    • @MarcelDempers
      @MarcelDempers  3 ปีที่แล้ว +1

      All k8s prometheus related items are under👉🏽 ./monitoring/prometheus/kubernetes/README.md

  • @robl39
    @robl39 11 หลายเดือนก่อน

    I wonder how much Marcel can bench press

  • @SteelerLemon0
    @SteelerLemon0 4 ปีที่แล้ว

    Does the python application have to be exposed to Prometheus metrics for this to work?

    • @MarcelDempers
      @MarcelDempers  4 ปีที่แล้ว

      An application needs to expose a "/metrics" endpoint to a Prometheus instance (not the operator) for this to work. A service monitor needs to select the application service correctly too

    • @SteelerLemon0
      @SteelerLemon0 4 ปีที่แล้ว

      Marcel Dempers -DevOpsGuy thank you for the quick response!

  • @supratimmukherjee8519
    @supratimmukherjee8519 3 ปีที่แล้ว

    For grafana, the pods do not come up and I see the error below for the pod events
    Normal Scheduled 2m29s default-scheduler Successfully assigned monitoring/grafana-f667ddbdc-2pk2p to ip-10-2-100-235.ec2.internal
    Warning FailedMount 26s kubelet, ip-10-2-100-235.ec2.internal Unable to attach or mount volumes: unmounted volumes=[grafana-dashboard-nodeexporter], unattached volumes=[grafana-dashboard-node-cluster-rsrc-use grafana-dashboards grafana-dashboard-k8s-resources-workloads-namespace grafana-dashboard-nodeexporter grafana-dashboard-proxy grafana-dashboard-namespace-by-pod grafana-dashboard-namespace-by-workload grafana-dashboard-node-rsrc-use grafana-dashboard-statefulset grafana-dashboard-k8s-resources-node grafana-datasources grafana-dashboard-scheduler grafana-dashboard-k8s-resources-workload grafana-dashboard-k8s-resources-pod grafana-dashboard-pods grafana-dashboard-workload-total grafana-dashboard-nodes grafana-dashboard-prometheus-remote-write grafana-storage grafana-dashboard-cluster-total grafana-dashboard-controller-manager grafana-dashboard-kubelet grafana-dashboard-prometheus grafana-dashboard-apiserver grafana-dashboard-k8s-resources-namespace grafana-dashboard-pod-total grafana-dashboard-persistentvolumesusage grafana-dashboard-k8s-resources-cluster grafana-token-xs4fs]: timed out waiting for the condition
    What am I missing here? I am simply applying everything from your repo.

    • @MarcelDempers
      @MarcelDempers  3 ปีที่แล้ว +1

      This does seem strange. Grafana mounts a ton of configmaps where the dashboard definitions are stored. Make sure the configmaps are created. You have to kubectl create not apply on the configmaps because the files are very large.
      Also make sure you're creating configmaps and the deployments in the right namespace as the tutorial suggests.
      Check th-cam.com/video/abq-6FBn0fo/w-d-xo.html too for more info

    • @supratimmukherjee8519
      @supratimmukherjee8519 3 ปีที่แล้ว

      @@MarcelDempers Yes thanks, using create instead of apply works but what is the rationale behind that, you mentioned to use create instead of apply for large config map files, I am wondering if I were to run this in a CI pipeline like argo, it will do an apply as part of sync and will fail, any thoughts on this?

  • @prashantpathak3175
    @prashantpathak3175 2 ปีที่แล้ว

    Can I use Prometheus without installing or deploying Prometheus Operator?

    • @MarcelDempers
      @MarcelDempers  2 ปีที่แล้ว +1

      Sure you can. You can run it as a deployment and simply keep data in memory or If the data is important to keep you can use a statefulset and appropriate volume to persist data to.

    • @prashantpathak3175
      @prashantpathak3175 2 ปีที่แล้ว

      @@MarcelDempers Can you please make a video where we monitor the ingress controller for nginx and then get the required matrix. In one of the video you have made is only to use ingress controller and there I did not understand how to get the domain name?

  • @m19mesoto
    @m19mesoto 3 ปีที่แล้ว

    Hello,
    I think, now is the time to do Thanos-Operator.. or just thanos.

  • @vtvvnha2230
    @vtvvnha2230 3 ปีที่แล้ว

    how to run 1 prometheus instance to monitor 2 seperate services in 2 seperate namespace

    • @MarcelDempers
      @MarcelDempers  3 ปีที่แล้ว

      Take a look at ServiceMonitors , you can select a service
      amespace to scrape and tell Prometheus which ServiceMonitors to select

  • @brijchavda
    @brijchavda 3 ปีที่แล้ว

    Would like to see thanos on kubernetes.

  • @sol5179
    @sol5179 4 ปีที่แล้ว +4

    I think background musics between chapters are little bit loud? Almost died of heart attack.

  • @albuch
    @albuch 3 ปีที่แล้ว

    Your source code links do not work. On this page there is a lot of broken links associated with you series ( github.com/marcel-dempers/docker-development-youtube-series) click on almost any Source link. (Found it)