Comments (6)
Could you share your HPA configurations after removing sensitive information? cc @az-software-engineer
from k8s-stackdriver.
@CatherineF-dev - Please see below.
Custom Metric:
![image](https://private-user-images.githubusercontent.com/167329990/325719487-0d833a17-bb9c-4181-b1b1-6fa74f9bd9db.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3ODQ1MTEsIm5iZiI6MTcyMzc4NDIxMSwicGF0aCI6Ii8xNjczMjk5OTAvMzI1NzE5NDg3LTBkODMzYTE3LWJiOWMtNDE4MS1iMWIxLTZmYTc0ZjliZDlkYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxNlQwNDU2NTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04YWQ3MTE3MDU5MDNiYjI3YTFmZGI4OGVlMDI2MGRjY2FlMDA1YTBjZDU2OGI1ZmQ3ZTU1YTIwODI1NmE1NjJlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.zErRABfA4q-yp6cT3lW-vYouD7esCX1eJ8k7yo5hlEU)
Custom Log-Based Metric:
![image](https://private-user-images.githubusercontent.com/167329990/325716242-d946c10f-1c58-4bb1-818d-e836f8df1b7d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3ODQ1MTEsIm5iZiI6MTcyMzc4NDIxMSwicGF0aCI6Ii8xNjczMjk5OTAvMzI1NzE2MjQyLWQ5NDZjMTBmLTFjNTgtNGJiMS04MThkLWU4MzZmOGRmMWI3ZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxNlQwNDU2NTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wOWRjOTYzYWVlMzg4OGE5YmJlYWQ3OGFlZWVjMzE1ZWM3NjNhNzMxZGJiMTQ1ZjVjOTBiNzlkZjdiMzdhYWZkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.M0SXNsDEO1l5xUE7adSUbjTwTDZKJPhd3zg6Iuta0uM)
Example Values:
minReplicas: 1
maxReplicas: 10
averageValue: 50
backend_target_name: xyz
** Is HPA able to scale off Custom Log-Based Metrics (logging.googleapis.com) VS. Custom Metrics (custom.googleapis.com)?
from k8s-stackdriver.
This is a working example https://stackoverflow.com/questions/78130483/horizontal-pod-autoscaler-with-stackdriver-custom-metric-in-gke-fails-with-inva.
Could you follow this to use loadbalacing.googleapis.com|https|request_count?
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: my-autoscale
namespace: somenamespace
spec:
maxReplicas: 3
metrics:
- pods:
metric:
name: prometheus.googleapis.com|jvm_memory_bytes_used|gauge
selector:
matchLabels:
metric.labels.area: heap
target:
averageValue: 2G
type: AverageValue
type: Pods
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: my-java-app
from k8s-stackdriver.
Thank you for the example. We've attempted the provided but using logging.googleapis.com rather than Prometheus. GKE accepts the new config but HPA still remains "Unable to read all metrics". Maybe the example worked due to the Prometheus use case?
from k8s-stackdriver.
For logging.googleapis.com metrics, found a similar example here https://cloud.google.com/kubernetes-engine/docs/tutorials/autoscaling-metrics#pubsub_8
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: pubsub
spec:
minReplicas: 1
maxReplicas: 5
metrics:
- external:
metric:
name: pubsub.googleapis.com|subscription|num_undelivered_messages
selector:
matchLabels:
resource.labels.subscription_id: echo-read
target:
type: AverageValue
averageValue: 2
type: External
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: pubsub
from k8s-stackdriver.
Unfortunately, that is not working either. In the example provided, you're referencing "pubsub.googleapis.com" which we have successfully configured and tested. However, we're trying to get "logging.googleapis.com" to work using a user-defined custom metric that captures log events.
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: abc-hpa
namespace: abc-frontend
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: abc-server-deployment
minReplicas: {{ .Values.abc.hpa.min_replicas }}
maxReplicas: {{ .Values.abc.hpa.max_replicas }}
metrics:
- external:
metric:
name: logging.googleapis.com|user|UserDefinedCustomMetric
target:
type: AverageValue
averageValue: {{ .Values.abc.hpa.averageValue }}
type: External
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: abc-server-deployment
from k8s-stackdriver.
Related Issues (20)
- Security Policy violation Binary Artifacts HOT 5
- Allow custom metrics from a different pod HOT 3
- Custom metrics adapter spewing errors "apiserver was unable to write a fallback JSON response: http2: stream closed" HOT 11
- custom-metrics-stackdriver-adapter - couldn't get resource list for external.metrics.k8s.io/v1beta1: Got empty response for: external.metrics.k8s.io/v1beta1 HOT 3
- istio.io/service/server/response_latencies metric that HPA collected is different to Cloud monitoring HOT 1
- Filtering metrics by labelSelector in external.metrics.k8s.io api doesn't work HOT 1
- Timeout error logs HOT 5
- Deploying adapter_new_resource_model.yaml results in OOMKilled HOT 3
- 100% memory and CPU and never recovers HOT 2
- Documentation bugs in custom-metrics-stackdriver-adapter README HOT 3
- Error while sending request to Stackdriver googleapi: Error 503 HOT 17
- Tracing custom-metrics-stackdriver-adapter trace logging enabled HOT 6
- wrong version of file in tag HOT 4
- Unable to authenticate the request err="verifying certificate failed: x509: certificate signed by unknown authority"" HOT 4
- Dependency Dashboard
- Changing port number might bring downtime in custom-metrics-stackdriver-adapter HOT 3
- Empty external metrics and retrieving the list under custom metrics lead to HPA not working HOT 1
- Empty external metrics list will fail the client-go CachedDiscoveryClient caching and make helm upgrade resending api call HOT 5
- Release https://github.com/GoogleCloudPlatform/k8s-stackdriver/pull/743
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 k8s-stackdriver.