Horizontal Pod Autoscaler CUSTOM METRICS & PROMETHEUS: (Kubernetes | EKS | Autoscaling | HPA | K8s)

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ส.ค. 2024

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

  • @AntonPutra
    @AntonPutra  11 หลายเดือนก่อน +2

    🔴 - To support my channel, I’d like to offer Mentorship/On-the-Job Support/Consulting - me@antonputra.com

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

    There's no stopping this guy.. 👍👍 Amazing explanation.. Thanks Anton 🙂

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

      Thank you Samay☺

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

    Антон, спасибо большое)
    Жаль что не нашел Ваш канал раньше, наверно сэкономил бы кучу времени)

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

    Hey Anton, ty for your great work.

  • @Adam1nToronto
    @Adam1nToronto 7 หลายเดือนก่อน

    Thank goodness TH-cam has a pause button. All the detail appears to be there, despite a lot of it being glossed over.

    • @AntonPutra
      @AntonPutra  7 หลายเดือนก่อน

      😅

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

    That's really amazing tutorial. Hope you will have more video tutorials.

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

      Thank you, I will

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

    👉 How to Manage Secrets in Terraform - th-cam.com/video/3N0tGKwvBdA/w-d-xo.html
    👉 Terraform Tips & Tricks - th-cam.com/video/7S94oUTy2z4/w-d-xo.html
    👉 ArgoCD Tutorial - th-cam.com/video/zGndgdGa1Tc/w-d-xo.html

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

    1. (Helm) How to Install Prometheus on Kubernetes Cluster? - th-cam.com/video/bwUECsVDbMA/w-d-xo.html
    2. (YAML) How to Install Prometheus on Kubernetes Cluster? - th-cam.com/video/mtE4migphGE/w-d-xo.html

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

    Thank you very much for this video, it's so clear!

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

    You are awesome, Thanks a ton

  • @valour.se47
    @valour.se47 3 ปีที่แล้ว +1

    That was great explanation

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

      Thank you Valour!

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

    Thanks a lot for the video Anton, it is very helpful. I would like to ask something:
    • What should I do to bind Prometheus with my server's IP instead of working as a localhost. I want to make it always listen instead of appyling port-forward command every time.

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

      Thanks, you create an ingress or expose it as a load balancer. Typically you would create private ingress, example (no need for annotation) - github.com/antonputra/tutorials/blob/main/lessons/082/example-1/prometheus.yaml

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

    amazing content man

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

    Anton, your tuto is amazing!!!! I finally could create a custom metric based on http request, however it's not scaling down. Once the pods scale up, they don't scale down to the minimum replicas configured. Would you know why this happens?

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

      Thanks Felipe! sometimes it takes 5-10 minutes to scale back, you should be able to find the reason in the log if it's stuck.

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

      @@AntonPutra I've tested it on minikube. Could this be a blocker?

  • @tkb12341
    @tkb12341 3 หลายเดือนก่อน

    Can we add our custom metrics as below: auto scale on increasing of user count. If so , can you share the Prometheus query and what is HPA scaler needs to be configured ?

    • @AntonPutra
      @AntonPutra  3 หลายเดือนก่อน

      I have updated version of that tutorial, pls take a look - github.com/antonputra/tutorials/tree/main/lessons/181/1-hpa/custom-metrics

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

    Hi Anton, great tutorial! I just didn't understand the resource section under rules in values.yaml of the helm chart. Could you please explain?
    Thanks.

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

      You mean this github.com/antonputra/tutorials/blob/main/lessons/073/values.yaml#L5-L31?
      Well, this tutorial slightly outdated due to the new K8s api versions, I'll refresh it soon.

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

      @@AntonPutra Yes, the resource section in the above block of code? Is it somehow related to the metrics-server?

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

      @@arthurshelby3593 no, in that case we don't need to deploy metric server. That block of code converts prometheus metrics to the Kubernetes API metrics

  • @tkb12341
    @tkb12341 3 หลายเดือนก่อน

    Hi Anton,
    Can you share the configuration for the below requirement:
    I need to do the auto scale on increase of user count accessing my UI application and it data traffic is above the threshold

    • @AntonPutra
      @AntonPutra  3 หลายเดือนก่อน

      I have updated version of that tutorial, pls take a look - github.com/antonputra/tutorials/tree/main/lessons/181/1-hpa/custom-metrics

  • @user-io8wi7wo7x
    @user-io8wi7wo7x 9 หลายเดือนก่อน

    I have problem when i use kube-prometheus-stack to monitor my application

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

    Hi, thanks for this great content. I deploy the express server but the /fibonacci gives back error and seems like the server cannot handle the GET request. What can be done?

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

    Awesome content Anton,
    Just wanted to know if the same could be done for Spring boot applications running in OpenShift 3.

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

      Thank you, I think so, but I never tried on OpenShift.

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

    Hi Anton. This video was very helpful. Have you consider making a Udemy course with more in-depth information on this topic? I cannot find anything like this on Udemy!

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

      Thanks Frances! Unfortunately, i have a full time job and have limited time to work on all of those ideas that I have including Udemy :)

  • @user-ei2wn4ud4l
    @user-ei2wn4ud4l ปีที่แล้ว

    wow

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

      I'll update this tutorial soon...

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

    All is working but when I try to create my own targets, but it nevers shows up. I did the same configuration of express application, put the label devops on the SM file. And adjusted the selectors to SM hit my Service

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

      try pod monitors, they are simpler

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

    Hey Anton, You'll still remain the best in the DevOps space.
    A quick one:
    1. I want to use the HPA to autoscale different services. I don't want to have each HPA yaml file configured for every microservice. That will be plenty YAML files to handle. The other way round will be to use a single HPA yaml with the "---" separator for all services in a single yaml (the downside is the file will be long)
    ** Can I create an HPA to target a whole namespace. So all Pods in that namespace should be handled by a single HPA yaml file. Something like: spec.scaleTargetRef.namespace=
    2. Outside this topic. I have read you can't use HPA and VPA together unless HPA is using a custom metric. Can I use both HPA and VPA for both CPU and memory metrics while setting updateMode=Off in the VPA so that the VPA only recommends and does not take action on my Pods.
    Thanks. Looking forward to your response

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

      To be honest I don't knoe, have you tried to use * in the selector?
      scaleTargetRef:
      apiVersion: apps/v1
      kind: Deployment
      name: *
      Also, if you don't want to copy yaml you can use kustomize (built in to kubectl) or even helm

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

    Hi nice .. explanation ..I have one doubt ..in AWS EKS.. Hpa or Vpa which is best for production applications deployment .

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

      defiantly hpa, most of your applications that you deploy to kubernetes should be horizontally scalable. I rarely see that anyone uses vpa.

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

    Hi Anton, can we specify multiple metrics in the "custom-metric-prometheus-adapter" configmap? I know hpa supports scaling on multiple metrics, but does prometheus-adpater supports using multiple metrics to scale?

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

      It's been a while, I think a lot has changed since I recorded that video..

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

    👍👍👍👍👍

  • @iskhak20
    @iskhak20 5 หลายเดือนก่อน

    Привет! Возможно ли обойтись без APIService для кастомных метрик? Спасибо!

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

    Hi Anton, I have a problem with this. when load increases hpa works properly, but when load decreases it does not remove additional pods

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

      The best way to find out the reason is to check logs on hpa controller. If you find an error let me know

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

    Hi ! Why i do not see the targets if i only deploy an app on default namespace ?

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

      Check service monitor and endpoint labels

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

    Hi Anton, I want to know that do we require amazon aws for this ekstcl cluster creation? Or solely eks.yaml file will be enough to create cluster?
    Thanks:))

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

      you need to have aws account, no vpc or anything else is necessary

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

    Hi Anton, thank you for this great stuff. I need a help !!!!
    I need to modify the default path which is /metrics (property : metrics_path) to my custom path i.e. "/actuator/prometheus" to get all the data. Can you please let me know in which file I can modify the property metrics_path ?

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

      In the service monitor under endpoint

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

      @@AntonPutra Thank you soo much :)

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

    Hi Anton, I need to autoscale for queue message count and for which I don't need groupby clause in metricsquery.
    metricsQuery: 'sum({})'
    It is scaling up the pod for message count custom metrics for me when groupby clause is present in the metricsquery. But I don't need group by because now both pods will share same message count and it takes the average. can you please let me know if I have to modify anything else to make metricsquery work without groupby clause ?

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

      To be honest, I don't really remember all the specifics

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

    I created my own custom metrics using prom-client in python which is a counter called "request_count" for my flask app.
    When I tried to scale with hpa using "request_count"; in the prometheus seeing the "request_count_total" I found that only one pod is serving all the requests; instead of all the pods getting created with hpa.
    Anton do you know what went wrong?

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

      Try to find a more descriptive error somewhere in the logs..

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

      ​@@AntonPutra
      In your first part you use the series query and with the prometheus adapater you don't use any series because "http_requests" have already been implemented by prometheus adapter, right? I just have a doubt here, I would like to know about it in detail.
      I just implemented your code and I think your implementation is similar to mine.
      If you go in the graphs section of the prometheus you will find out that your implementation too has the same issue as mine only one pod is handling all the requests.
      In the graph you will find only one pod handling all the requests and no other pod is handling any request.
      You can reproduce the issue with prometheus adapter helm chart + your code and check.

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

      @@JackReacher1 it’s been a while ago, I don’t remember all the details

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

      ​@@AntonPutra I can understand that.
      Just out of curiosity, if someone told you to complete the above process for a microservice in a company.
      How much time would it take you to get a dev level code solution?

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

      @@JackReacher1 it depends how well you know the service. POC is easy, you can come up with working solution for a day or two.. I would say it will take much longer to test and set some trasholds.

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

    Can you please re-upload this video without the background music?

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

      Yes, I’m planning to update it soon

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

      @@AntonPutra 🙏 Thank you !!

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

    Unfortunately this never worked for me 😢😢😢😢

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

      I'll update this video soon

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

    It's all good but too high level. I don't know if only I feel like this. Like if you could add a bit more context on what's happening. Rather than just pasting a block of yaml. Especially for beginners out there. But think your content is not meant for beginners.

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

      Noted. Also, this tutorial is slightly outdated. Newer versions of Kubernetes are using new API versions. I'll update it soon.

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

    Hi Anton,
    I was trying to use external metrics for autoscaling and getting below error. It would be a great help if you can guide me to fix it:
    the HPA was unable to compute the replica count: unable to get external metric demo/submitter_queue_message_total/nil: unable to fetch metrics from external metrics API: submitter_queue_message_total.external.metrics.k8s.io is forbidden: User "system:serviceaccount:kube-system:horizontal-pod-autoscaler" cannot list resource "submitter_queue_message_total" in API group "external.metrics.k8s.io" in the namespace "demo"

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

      looks like you need to bind your k8s service account with clusterrole or a role that has proper access