<p>I am trying to create a HPA using Prometeus and Prometeus Adapter.</p>
<p>I am getting a &quot;unexpected GroupVersion&quot; error in the Status and I just have no idea what it means.</p>
<pre><code>$ kubectl describe hpa
Name:                                             pathology-uploader-hpa
Namespace:                                        default
Labels:                                           &lt;none&gt;
Annotations:                                      &lt;none&gt;
CreationTimestamp:                                Tue, 08 Mar 2022 15:50:12 +0000
Reference:                                        Deployment/pathology-uploader-dep
Metrics:                                          ( current / target )
  &quot;pathology_uploader_avg_process_time&quot; on pods:  &lt;unknown&gt; / 180k
Min replicas:                                     1
Max replicas:                                     100
Deployment pods:                                  0 current / 0 desired
Conditions:
  Type         Status  Reason          Message
  ----         ------  ------          -------
  AbleToScale  False   FailedGetScale  the HPA controller was unable to get the target's current scale: unexpected GroupVersion string: /apps/v1
Events:
  Type     Reason          Age                   From                       Message
  ----     ------          ----                  ----                       -------
  Warning  FailedGetScale  4m34s (x41 over 14m)  horizontal-pod-autoscaler  unexpected GroupVersion string: /apps/v1
</code></pre>
<p>Here is my spec:</p>
<pre><code>apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: pathology-uploader-hpa
spec:
  maxReplicas: 100 # define max replica count
  minReplicas: 1   # define min replica count
  scaleTargetRef:
    kind: Deployment
    name: pathology-uploader-dep
    apiVersion: /apps/v1
  metrics:
    - type: Pods
      pods:
        metric:
          name: pathology_uploader_avg_process_time
        target:
          type: AverageValue
          averageValue: 180000  # allow one job to take 3 minutes
</code></pre>
<p>I am using the helm charts supplied by the prometheus-community. The rules section that I have supplied to the prometheus-adapter is</p>
<pre><code>rules:
  default: true
  custom:
  - seriesQuery: '{__name__=~&quot;^pathology_uploader_process_time$&quot;}'
    resources:
      template: &lt;&lt;.Resource&gt;&gt;
    name:
      matches: &quot;.*&quot;
      as: &quot;pathology_uploader_avg_process_time&quot;
    metricsQuery: &lt;&lt;.Series&gt;&gt;
prometheus:
  url: http://prometheus-server.default.svc
  port: 80
  path: &quot;&quot;
</code></pre>

user2577528
<p>Update your spec like below.</p>
<p>&quot;/apps/v1&quot; to &quot;apps/v1&quot;</p>
<pre><code>apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: pathology-uploader-hpa
spec:
  maxReplicas: 100 # define max replica count
  minReplicas: 1   # define min replica count
  scaleTargetRef:
    kind: Deployment
    name: pathology-uploader-dep
    ## update &quot;/apps/v1&quot; to &quot;apps/v1&quot;
    apiVersion: apps/v1
</code></pre>
