I want to scale my application based on custom metrics (RPS or active connections in this cases). Without having to set up prometheus or use any external service. I can expose this API from my web app. What are my options?
How to scale my app on nginx metrics without prometheus?
672 views Asked by Zàf Mohammed At
1
There are 1 answers
Related Questions in KUBERNETES
- Golang == Error: OCI runtime create failed: unable to start container process: exec: "./bin": stat ./bin: no such file or directory: unknown
- I can't create a pod in minikube on windows
- Oracle setting up on k8s cluster using helm charts enterprise edition
- Retrieve the Dockerfile configuration from the Kubernetes and also change container Java parameter?
- Summarize pods not running, by Namespace and Reason - I'm having trouble finding the reason
- How to get Java running parameters from Spring Boot running inside container in pod where no ps exist
- How do we configure prometheus server to scrape metrics from a pod with Istio sidecar proxy?
- In rke kube-proxy pod is not present
- problem with edge server registration in Eureka
- Unable to Access Kubernetes LoadBalancer Service from Local Device Outside Cluster
- Kubernetes cluster on GCE connection refused error
- Based on my experience, I've outlined the Kubernetes request flow. Could someone please add or highlight any points I might have overlooked?
- how to define StackGres helm chart "restapi" values to use internal LoadBalancer - AWS EKS
- Python3.11 can't open file [Errno 2] No such file or directory
- Cannot find remote pod service - SERVICE_UNAVAILABLE
Related Questions in HORIZONTALPODAUTOSCALER
- Horizontal Pod Autoscaling in Kubernetes Google Cloud with custom metric
- Is there a simpler cronjob for keeping a cluster up only during workday hours?
- keda-operator-metrics-apiserver: no matching metrics found for s0-prometheus-http_requests_in_progress
- Kubernetes HorizontalPodAutoscaler Scale in multiples of 3
- No matches for kind "HorizontalPodAutoscaler" in version "autoscaling/v2" when installing knative serving
- How to get last updated date for k8s hpa?
- What is the unit of lower case "m" and "k" in the image below?
- Why is there an error in Horizontal Pod Autoscaler Yaml?
- What is the "status" in the autoscaler yaml in k8s?
- Pulumi: how to correctly use HorizontalPodAutoscaler
- How does the scale function in Kubernetes ensure that the current task or request is completed when scaling down?
- HorizontalPodAutoscaler scales up pods but then terminates them instantly
- AKS - Pods created by HPA trigger are getting terminated immediately after they are created
- kubernetes does not deploy HorizontalPodAutoscaler when applied within range
- How to scale my app on nginx metrics without prometheus?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Monitoring different types of metrics (e.g. custom metrics) on most Kubernetes clusters is the foundation that leads to more stable and reliable systems/applications/workloads. As discussed in the comments section, to monitor custom metrics, it is recommended to use tools designed for this purpose rather than inventing a workaround. I'm glad that in this case the final decision was to use Prometheus and KEDA to properly scale the web application.
I would like to briefly show other community members who are struggling with similar considerations how KEDA works.
To use Prometheus as a scaler for Keda, we need to install and configure Prometheus. There are many different ways to install Prometheus and you should choose the one that suits your needs.
I've installed the kube-prometheus stack with Helm:
NOTE: I allowed Prometheus to discover all
PodMonitors/ServiceMonitorswithin its namespace, without applying label filtering by setting theprometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValuesandprometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValuesvalues tofalse.Then we can deploy an application that will be monitored by Prometheus. I've created a simple application that exposes some metrics (such as
nginx_vts_server_requests_total) on the/status/format/prometheuspath:Next, create a ServiceMonitor that describes how to monitor our
app-1application:After waiting some time, let's check the
app-1logs to make sure that it is scrapped correctly:Now it's time to deploy KEDA. There are a few approaches to deploy KEDA runtime as described in the KEDA documentation. I chose to install KEDA with Helm because it's very simple :-)
The last thing we need to create is a
ScaledObjectwhich is used to define how KEDA should scale our application and what the triggers are. In the example below, I used thenginx_vts_server_requests_totalmetric.NOTE: For more information on the prometheus trigger, see the Trigger Specification documentation.
Finally, we can check if the
app-1application scales correctly based on the number of requests:As you can see above, our application has been correctly scaled to 5 replicas.