Reputation: 11
I have following yaml-configuration for my horizontal pod autoscaler in GCP.
//...
metrics:
- type: Pods
pods:
metric:
name: "my-custom-metric"
target:
type: AverageValue
averageValue: 60
//..
I have added the metric as a custom metric in metric explorer in Cloud Monitoring. It is a log based metric. I have even added it to a dashboard and it looks fine.
For HPA the metric is not found. I get "Unable to read all metrics".
I'm not sure why? Do I need to add specific permissions in my serviceaccount? Or do I need to use a Custom Metrics Adapter? Does the HPA not have access without a adapter?
I have even tried to add the full name path for the metric name, but I get an error that "/" is not allowed in the name.
I would appreciate any help!
Upvotes: 0
Views: 487
Reputation: 2495
Indeed, you need to deploy a metric server, please refer to this link. And bear in mind that it works for cpu and memory.
Notice:
Kubelet certificate needs to be signed by cluster Certificate Authority (or disable certificate validation by passing --kubelet-insecure-tls to Metrics Server) So add under args (you will get some headaches and TLS can be added later):
- --kubelet-insecure-tls
Notice: Before reading below check this out.
This will require some custom resource definition as well as adapter, metrics api. This video might help A LOT :)
https://www.youtube.com/watch?v=iodq-4srXA8&t=550s
Bonus track: do not hesitate to use siege to stress the pods, also i would try scale up and scale down :)
Upvotes: 1