Skip to content

kubectl top pod is doesn't work #2579

Open
@XiaoChouYou

Description

@XiaoChouYou

What happened?

[root@master kube-prometheus-0.14.0]# kubectl top pod
error: Metrics not available for pod default/php-apache-675bc649f5-tcb2w, age: 25h52m7.042307327s
[root@master kube-prometheus-0.14.0]#

Did you expect to see some different?
the Adapter it get node status is wrong

How to reproduce it (as minimally and precisely as possible):
i just install with cmdline :

kubectl apply --server-side -f kube-prometheus-0.14.0/manifests/setup/
kubectl apply --server-side -f kube-prometheus-0.14.0/manifests

Environment

  • Prometheus Operator version:

prometheus-operator/prometheus-operator:v0.76.2

  • Kubernetes version information:

k8s vesion is v1.28.2

  • Kubernetes cluster kind:

    insert how you created your cluster: kops, bootkube, tectonic-installer, etc.

  • Manifests:

insert manifests relevant to the issue
  • Prometheus Operator Logs:
Insert Prometheus Operator logs relevant to the issue here
  • Prometheus Logs:

{"httpRequest":{"clientIP":"10.244.1.198","method":"GET","path":"/api/v1/query"},"params":{"end":"2024-12-31T16:02:23.124Z","query":"sum by (pod,container) (\n irate (\n container_cpu_usage_seconds_total{namespace="default",pod="php-apache-675bc649f5-tcb2w",container!="",pod!=""}[120s]\n )\n)\n","start":"2024-12-31T16:02:23.124Z","step":0},"spanID":"0000000000000000","stats":{"timings":{"evalTotalTime":0.000056403,"resultSortTime":0,"queryPreparationTime":0.000027109,"innerEvalTime":0.000025544,"execQueueTime":0.000011317,"execTotalTime":0.000061844},"samples":{"totalQueryableSamples":0,"peakSamples":0}},"ts":"2024-12-31T16:02:23.127Z"}

Anything else we need to know?:

i think that container_cpu_usage_seconds_total not have the "container" metrics ,but prometheusAdapter-configMap.yaml config that cmd include "container"
and this is my prometheus demo data

container_cpu_usage_seconds_total{cpu="total", endpoint="https-metrics", id="/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod7d0c9045_7054_4491_9d28_3b3d488d7410.slice", instance="192.168.16.201:10250", job="kubelet", metrics_path="/metrics/cadvisor", namespace="default", node="node1", pod="php-apache-675bc649f5-tcb2w", service="kubelet"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions