Comments (4)
I have tried this:
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: custom-metrics-consumer
namespace: default
labels:
application: custom-metrics-consumer
annotations:
# metric-config.<metricType>.<metricName>.<collectorName>/<configKey>
metric-config.object.prometheus-target-kbasync-lenh-seca.prometheus/query: |
scalar(sum(rate(collectd_statsd_derive_total{statsd="prometheus_target_kbasync_lenh_seca"}[20m])))
metric-config.object.prometheus-target-kbasync-lenh-seca.prometheus/per-replica: "true"
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: custom-metrics-consumer
minReplicas: 1
maxReplicas: 10
metrics:
- type: Object
object:
metricName: prometheus-target-kbasync-lenh-seca
target:
apiVersion: v1
kind: .
name: custom-metrics-consumer
targetValue: 10 # this will be treated as targetAverageValue
My prometheus query is correct :
curl -g prometheus.monitoring.svc:9090/api/v1/query?query="scalar(sum(rate(collectd_statsd_derive_total{statsd='prometheus_target_kbasync_lenh_sec'}[5m])))"
{"status":"success","data":{"resultType":"scalar","result":[1544377450.443,"0.008333333333333333"]}}
Edit: Updated correct HPA
from kube-metrics-adapter.
was able to get it working with above HPA but kind is getting stored as ""
for my metric
eg:
kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/namespaces/default/""/*/prometheus-target-kbasync-lenh-sec" --kubeconfig=config-demo | jq
{
"kind": "MetricValueList",
"apiVersion": "custom.metrics.k8s.io/v1beta1",
"metadata": {
"selfLink": "/apis/custom.metrics.k8s.io/v1beta1/namespaces/default//%2A/prometheus-target-kbasync-lenh-sec"
},
"items": [
{
"describedObject": {
"kind": "Deployment",
"namespace": "default",
"name": "custom-metrics-consumer",
"apiVersion": "v1"
},
"metricName": "prometheus-target-kbasync-lenh-sec",
"timestamp": "2018-12-09T18:46:24Z",
"value": "2m"
}
]
}
how do i tell what kind to use so that HPA will fetch the metrics properly ?
from kube-metrics-adapter.
logs:
I1209 19:39:13.546788 1 wrap.go:42] GET /apis/custom.metrics.k8s.io/v1beta1/namespaces/default/deployments/custom-metrics-consumer/prometheus-target-kbasync-lenh-seca: (1.950008ms) 404
but if replace deployment
with ""
or .
or empty it works.
kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/namespaces/default/""/*/prometheus-target-kbasync-lenh-sec" --kubeconfig=config-demo | jq
{
"kind": "MetricValueList",
"apiVersion": "custom.metrics.k8s.io/v1beta1",
"metadata": {
"selfLink": "/apis/custom.metrics.k8s.io/v1beta1/namespaces/default//%2A/prometheus-target-kbasync-lenh-sec"
},
"items": [
{
So prometheus collector is not storing the kind correctly ?.
HPA doesnt accept "", . or empty for kind in object.target
field
from kube-metrics-adapter.
so i looked at the code and found
groupResource = schema.GroupResource{
Resource: "pods",
}
case "Ingress":
groupResource = schema.GroupResource{
Resource: "ingresses",
Group: "extensions",
}
}
There is no support for deployment and when i changed kind to pod it started working.
Closing this issue
from kube-metrics-adapter.
Related Issues (20)
- [FeatureRequest] ScalingSchedule: add crontab schedule
- container release tag concept HOT 2
- Panic: assignment to entry in nil map HOT 7
- update to work with kube 1.22 HOT 2
- Update outdated base image? HOT 2
- Kustomize support HOT 1
- Helm chart should be available in a chart repository HOT 8
- [Doc Question] May I config multiple type of collector in a single HPA HOT 2
- Is it possible to retrieve request per second to pod without using prometheus? HOT 4
- Parameters consultation
- Missing Documentation for kubernetes compatibility matrix HOT 1
- Update k8s autoscaling dependency to v2 version to support Kubernetes 1.26+ HOT 1
- Metric Adapter is taking metrics from cache HOT 1
- Is that feasible to run the adapter into a namespace different from `kube-system`? HOT 3
- Make log level configurable
- Docker image for arm64 not published HOT 1
- HPA metric got stuck at a random value and not scaling down after reaching max replica count HOT 12
- No latest tag exists for ghcr.io repo
- Error: the server could not find the requested resource HOT 1
- feature: add Argo Rollouts support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kube-metrics-adapter.