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.