Hello,

I want to get custom metrics (cpu utilization percentage) from the 
prometheus-adapter.
I've used helm to install the prometheus-adapter file with the conf file 
I've attached and then when I execute: kubectl I get this:
{"name":"pods/malakas","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]}
{"name":"namespaces/malakas","singularName":"","namespaced":false,"kind":"MetricValueList","verbs":["get"]}

but when I execute: kubectl get --raw 
"/apis/custom.metrics.k8s.io/v1beta1/namespaces/default/pods/*/malakas" | 
jq .
{
  "kind": "MetricValueList",
  "apiVersion": "custom.metrics.k8s.io/v1beta1",
  "metadata": {
    "selfLink": 
"/apis/custom.metrics.k8s.io/v1beta1/namespaces/default/pods/%2A/malakas"
  },
  "items": []
}

Can anyone help me solve this issue in order not to get zero items?

Thank you in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/55ac8626-7155-4b41-a3a9-5d201a05ebf5n%40googlegroups.com.
# Default values for k8s-prometheus-adapter..
affinity: {}

image:
  repository: directxman12/k8s-prometheus-adapter-amd64
  tag: v0.8.3
  pullPolicy: IfNotPresent

logLevel: 4

metricsRelistInterval: 1m

listenPort: 6443

nodeSelector: {}

priorityClassName: ""

# Url to access prometheus
prometheus:
  # Value is templated
  url: http://10.111.7.89
  port: 80
  path: ""

replicas: 1

rbac:
  # Specifies whether RBAC resources should be created
  create: true

psp:
  # Specifies whether PSP resources should be created
  create: false

serviceAccount:
  # Specifies whether a service account should be created
  create: true
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname 
template
  name:
# Custom DNS configuration to be added to prometheus-adapter pods
dnsConfig: {}
# nameservers:
#   - 1.2.3.4
# searches:
#   - ns1.svc.cluster-domain.example
#   - my.dns.search.suffix
# options:
#   - name: ndots
#     value: "2"
#   - name: edns0
resources: {}
  # requests:
  #   cpu: 100m
  #   memory: 128Mi
  # limits:
  #   cpu: 100m
  #   memory: 128M

rules:
    custom:
    - seriesQuery: 'container_cpu_usage_seconds_total{container="php-apache"}'
      resources:
        overrides:
          namespace:
            resource: namespace
          pod:
            resource: pod
      name:
        matches: "container_cpu_usage_seconds_total"
        as: "malakas"
      metricsQuery:  sum by (container) 
(rate(container_cpu_usage_seconds_total{container="php-apache"}[2m]))*100
service:
  annotations: {}
  port: 443
  type: ClusterIP

tls:
  enable: false
  ca: |-
    # Public CA file that signed the APIService
  key: |-
    # Private key of the APIService
  certificate: |-
    # Public key of the APIService

# Any extra arguments
extraArguments: []
  # - --tls-private-key-file=/etc/tls/tls.key
  # - --tls-cert-file=/etc/tls/tls.crt

# Any extra volumes
extraVolumes: []
  # - name: example-name
  #   hostPath:
  #     path: /path/on/host
  #     type: DirectoryOrCreate
  # - name: ssl-certs
  #   hostPath:
  #     path: /etc/ssl/certs/ca-bundle.crt
  #     type: File

# Any extra volume mounts
extraVolumeMounts: []
  #   - name: example-name
  #     mountPath: /path/in/container
  #   - name: ssl-certs
  #     mountPath: /etc/ssl/certs/ca-certificates.crt
  #     readOnly: true

tolerations: []

# Labels added to the pod
podLabels: {}

# Annotations added to the pod
podAnnotations: {}

hostNetwork:
  # Specifies if prometheus-adapter should be started in hostNetwork mode.
  #
  # You would require this enabled if you use alternate overlay networking for 
pods and
  # API server unable to communicate with metrics-server. As an example, this 
is required
  # if you use Weave network on EKS. See also dnsPolicy
  enabled: false

# When hostNetwork is enabled, you probably want to set this to 
ClusterFirstWithHostNet
# dnsPolicy: ClusterFirstWithHostNet

podDisruptionBudget:
  # Specifies if PodDisruptionBudget should be enabled
  # When enabled, minAvailable or maxUnavailable should also be defined.
  enabled: false
  minAvailable:
  maxUnavailable: 1

certManager:
  enabled: false
  caCertDuration: 43800h
  certDuration: 8760h

Reply via email to