Yes, I'm sorry, I missed from your previous email that this is running on GKE.
The issue is that currently (in the beta period) custom metric must be exported to Stackdriver by a single pod (see: https://cloud.google.com/kubernetes-engine/docs/tutorials/custom-metrics-autoscaling#choosing_a_custom_metric). This means that following part of your yaml is problematic: - type: Object object: target: kind: *Deployment* At the moment, the only supported config is - type: Object object: target: kind:* Pod* On Tuesday, March 27, 2018 at 11:12:56 AM UTC+2, Sachith Wanniarachchi wrote: > > Hi, > > I am running this on google cloud. > > output to the kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/" -- > {"kind":"APIResourceList","apiVersion":"v1","groupVersion":"custom.metrics.k8s.io/v1beta1","resources":[{"name":"pods/rabbit_monitoring_autoscale","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]}]} > > > On Tuesday, March 27, 2018 at 1:44:24 PM UTC+5:30, Beata Skiba wrote: >> >> Can you verify if custom metrics are available with >> >> kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/" >> >> >> Which cloudprovider are you using? Also, what are you using to provide >> custom metrics ( >> https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics >> )? >> >> On Tuesday, March 27, 2018 at 7:30:42 AM UTC+2, Sachith Wanniarachchi >> wrote: >>> >>> Hello, >>> >>> I want to auto scale a deployment (scio-rpeak-filter) based on custom >>> matric. Kubernetes version is 1.9.4-gke.1. But my HPA is not working as >>> it give this massage. >>> >>> Name: >>>>> rpeak-pod-scaller >>>> >>>> Namespace: >>>>> default >>>> >>>> Labels: <none> >>>> >>>> Annotations: >>>>> kubectl.kubernetes.io/last-applied-configuration={ >>>>> <http://kubectl.kubernetes.io/last-applied-configuration=%7B> >>>>> "apiVersion":"autoscaling/v2beta1","kind":"HorizontalPodAutoscaler","metadata" >>>> >>>> >>>>> :{"annotations":{},"name":"rpeak-pod-scaller","namespace":"default"},"sp... >>>> >>>> CreationTimestamp: Thu, >>>>> 22 Mar 2018 16:24:03 +0530 >>>> >>>> Reference: >>>>> Deployment/scio-rpeak-filter >>>> >>>> Metrics: ( >>>>> current / target ) >>>> >>>> "rabbit_monitoring_autoscale" on Deployment/scio-rabbit-agent: >>>>> <unknown> / 1 >>>> >>>> Min replicas: 1 >>>> >>>> Max replicas: 3 >>>> >>>> Conditions: >>>> >>>> Type Status Reason Message >>>> >>>> ---- ------ ------ ------- >>>> >>>> AbleToScale True SucceededGetScale the HPA controller was >>>>> able to get the target's current scale >>>> >>>> ScalingActive False FailedGetObjectMetric the HPA was unable to >>>>> compute the replica count: unable to get metric >>>>> rabbit_monitoring_autoscale: Deployment on default >>>>> scio-rabbit-agent/unable >>>> >>>> to fetch metrics from API: pods "scio-rabbit-agent" not found >>>> >>>> Events: >>>> >>>> Type Reason Age From >>>>> Message >>>> >>>> ---- ------ ---- ---- >>>>> ------- >>>> >>>> Warning FailedGetObjectMetric 3m (x6567 over 4d) >>>>> horizontal-pod-autoscaler unable to get metric >>>>> rabbit_monitoring_autoscale: Deployment on default >>>>> scio-rabbit-agent/unable >>>>> to fetch metrics >>>> >>>> from API: pods "scio-rabbit-agent" not found >>>> >>>> >>> HPA.yaml is as follows. >>> >>> apiVersion: autoscaling/v2beta1 >>>> >>>> kind: HorizontalPodAutoscaler >>>> >>>> metadata: >>>> >>>> name: rpeak-pod-scaller >>>> >>>> namespace: default >>>> >>>> spec: >>>> >>>> scaleTargetRef: >>>> >>>> apiVersion: extensions/v1beta1 >>>> >>>> kind: Deployment >>>> >>>> name: scio-rpeak-filter >>>> >>>> minReplicas: 1 >>>> >>>> maxReplicas: 3 >>>> >>>> metrics: >>>> >>>> - type: Object >>>> >>>> object: >>>> >>>> target: >>>> >>>> kind: Deployment >>>> >>>> name: scio-rabbit-agent >>>> >>>> metricName: rabbit_monitoring_autoscale >>>> >>>> targetValue: 1 >>>> >>>> >>> Please help me to fix this issue. >>> >>> Thanks. >>> >> -- You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group. To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-users+unsubscr...@googlegroups.com. To post to this group, send email to kubernetes-users@googlegroups.com. Visit this group at https://groups.google.com/group/kubernetes-users. For more options, visit https://groups.google.com/d/optout.