I have added the haproxy_exporter and prometheus-to-sd containers as side-cars 
to my haproxy deployment in a non-default namespace.  I am seeing the metric I 
want in Metrics Explorer as well and can graph over time/ under load.  So, the 
data is getting out of the pod.  I can also verify the metric I want is here:

kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/" | jq . 

    {
      "name": "*/haproxy_frontend_current_session_rate",
      "singularName": "",
      "namespaced": true,
      "kind": "MetricValueList",
      "verbs": [
        "get"
      ]
    },



apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  name: proxy-hpa
  namespace: edge
  labels:
    chart: "{{.Chart.Name}}-{{.Chart.Version}}"
spec:
  scaleTargetRef:
    apiVersion: apps/v1beta1
    kind: Deployment
    name: proxy-deployment
  minReplicas: {{.Values.hpa.minReplicas}}
  maxReplicas: {{.Values.hpa.maxReplicas}}
  metrics:
  - type: Pods
    pods:
      metricName: haproxy_frontend_current_session_rate
      targetAverageValue: 2


(it's a low target value, as this is a test to show that HPA for custom metrics 
works)


I get the following error condition:

Conditions:
  Type           Status  Reason               Message
  ----           ------  ------               -------
  AbleToScale    True    SucceededGetScale    the HPA controller was able to 
get the target's current scale
  ScalingActive  False   FailedGetPodsMetric  the HPA was unable to compute the 
replica count: unable to get metric haproxy_frontend_current_session_rate: 
unable to fetch metrics from API: the server could not find the metric 
haproxy_frontend_current_session_rate for pods



What I believe is happening is that the hpa is being created (correctly) in the 
unique namespace, but the metrics it wants is in the default namespace (or 
kube-system namespace).

Am I interpreting that correctly?  Any way around that?

TIA,

Robby Morris

-- 
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.

Reply via email to