Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metrics are just available for nodes and kube-system namespace #1018

Closed
Al4DIN opened this issue May 4, 2022 · 13 comments
Closed

Metrics are just available for nodes and kube-system namespace #1018

Al4DIN opened this issue May 4, 2022 · 13 comments
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@Al4DIN
Copy link

Al4DIN commented May 4, 2022

Hello @serathius , @yangjunmyfm192085
I've the same issue on kubectl v1.22.5 client & v1.22.1 for the server, I can only retrieve metrics from node and some pods from my kube-system since I installed my metrics-server on this namespace but can't get other pods metrics.
I'm using k8s.gcr.io/metrics-server/metrics-server:v0.4.1
This is the result of my kubectl get --raw /api/v1/nodes/minikube2/proxy/metrics/resource

# HELP node_cpu_usage_seconds_total [ALPHA] Cumulative cpu time consumed by the node in core-seconds
# TYPE node_cpu_usage_seconds_total counter
node_cpu_usage_seconds_total 1762.835513 1651568930091
# HELP node_memory_working_set_bytes [ALPHA] Current working set of the node in bytes
# TYPE node_memory_working_set_bytes gauge
node_memory_working_set_bytes 3.749752832e+09 1651568930091
# HELP scrape_error [ALPHA] 1 if there was an error while getting container metrics, 0 otherwise
# TYPE scrape_error gauge
scrape_error 0

Originally posted by @Al4DIN in #976 (comment)

@yangjunmyfm192085
Copy link
Contributor

Hi @Al4DIN, metrics-server:v0.4.1 use data from the kubelet stats/summary endpoint, not metrics/resource.

you can try to use

NODE_NAME=<Name of node in your cluster>
kubectl get --raw /api/v1/nodes/$NODE_NAME/proxy/stats/summary | jq '{cpu: .node.cpu, memory: .node.memory}'

to get raw data.

@yangjunmyfm192085
Copy link
Contributor

You can check if it exists #976 (comment) mentioned in the case.

@Al4DIN
Copy link
Author

Al4DIN commented May 4, 2022

Thank you for your reponse, here's my command result, and since I'm using minikube on Windows
kubectl get --raw /api/v1/nodes/$NODE_NAME/proxy/stats/summary

{
 "node": {
  "nodeName": "minikube2",
  "systemContainers": [
   {
    "name": "kubelet",
    "startTime": "2022-05-03T08:26:18Z",
    "cpu": {
     "time": "2022-05-04T10:11:11Z",
     "usageNanoCores": 0,
     "usageCoreNanoSeconds": 23102720953300
    },
    "memory": {
     "time": "2022-05-04T10:11:11Z",
     "availableBytes": 78282752,
     "usageBytes": 4188815360,
     "workingSetBytes": 4116021248,
     "rssBytes": 3816587264,
     "pageFaults": 40227,
     "majorPageFaults": 99
    }
   },
   {
    "name": "runtime",
    "startTime": "2022-05-03T08:25:53Z",
    "cpu": {
     "time": "2022-05-04T10:11:11Z",
     "usageNanoCores": 0,
     "usageCoreNanoSeconds": 23102720953300
    },
    "memory": {
     "time": "2022-05-04T10:11:11Z",
     "availableBytes": 78282752,
     "usageBytes": 4188815360,
     "workingSetBytes": 4116021248,
     "rssBytes": 3816587264,
     "pageFaults": 40227,
     "majorPageFaults": 99
    }
   },
   {
    "name": "pods",
    "startTime": "2022-05-03T08:26:19Z",
    "cpu": {
     "time": "2022-05-04T10:12:02Z",
     "usageNanoCores": 490859521,
     "usageCoreNanoSeconds": 15090179481700
    },
    "memory": {
     "time": "2022-05-04T10:12:02Z",
     "availableBytes": 10298327040,
     "usageBytes": 3068940288,
     "workingSetBytes": 2997530624,
     "rssBytes": 2794213376,
     "pageFaults": 0,
     "majorPageFaults": 0
    }
   }
  ],
  "startTime": "2022-05-02T20:33:00Z",
  "cpu": {
   "time": "2022-05-04T10:12:00Z",
   "usageNanoCores": 1001610985,
   "usageCoreNanoSeconds": 23143142465300
  },
  "memory": {
   "time": "2022-05-04T10:12:00Z",
   "availableBytes": 9185341440,
   "usageBytes": 4188213248,
   "workingSetBytes": 4110516224,
   "rssBytes": 3810488320,
   "pageFaults": 40227,
   "majorPageFaults": 99
  },
  "network": {
   "time": "2022-05-04T10:12:00Z",
   "name": "eth0",
   "rxBytes": 327792110,
   "rxErrors": 0,
   "txBytes": 131548915,
   "txErrors": 0,
   "interfaces": [
    {
     "name": "tunl0",
     "rxBytes": 0,
     "rxErrors": 0,
     "txBytes": 0,
     "txErrors": 0
    },
    {
     "name": "sit0",
     "rxBytes": 0,
     "rxErrors": 0,
     "txBytes": 0,
     "txErrors": 0
    },
    {
     "name": "eth0",
     "rxBytes": 327792110,
     "rxErrors": 0,
     "txBytes": 131548915,
     "txErrors": 0
    }
   ]
  },
  "fs": {
   "time": "2022-05-04T10:12:00Z",
   "availableBytes": 188654366720,
   "capacityBytes": 269490393088,
   "usedBytes": 67075354624,
   "inodesFree": 15624261,
   "inodes": 16777216,
   "inodesUsed": 1152955
  },
  "runtime": {
   "imageFs": {
    "time": "2022-05-04T10:12:00Z",
    "availableBytes": 188654366720,
    "capacityBytes": 269490393088,
    "usedBytes": 14249286657,
    "inodesFree": 15624261,
    "inodes": 16777216,
    "inodesUsed": 1152955
   }
  },
  "rlimit": {
   "time": "2022-05-04T10:12:05Z",
   "maxpid": 4194304,
   "curproc": 1974
  }
 },
 "pods": []
} 

We can clearly see that for pods I'm not geting any ressource. I've also tried many solution on stackoverflow and github issues but still can't figure out the cause.

@yangjunmyfm192085
Copy link
Contributor

Yeah, Your analysis is correct.
Then this is not a metrics-server issue.
It is recommended to open an issue in kubernetes/kubernetes and try to analyze this issue.

@yangjunmyfm192085
Copy link
Contributor

/kind support

@k8s-ci-robot k8s-ci-robot added the kind/support Categorizes issue or PR as a support question. label May 5, 2022
@Al4DIN
Copy link
Author

Al4DIN commented May 5, 2022

Okay, thank you.
I'm closing this issue.

@Al4DIN Al4DIN closed this as completed May 5, 2022
@Al4DIN
Copy link
Author

Al4DIN commented May 11, 2022

Actually It was relate to Minikube Environnement where you need to add an argument while launching your minikube minikube start --extra-config=kubelet.housekeeping-interval=10s

@serathius
Copy link
Contributor

Nice, looks like something we could document as a known issue.

@Al4DIN
Copy link
Author

Al4DIN commented May 11, 2022

The problem is that an old issue that It's still not pushed in the release version of Minikube.

@serathius
Copy link
Contributor

I mean yes, it would be ideal for owners of K8s distribution to fix/document their distro. From Metrics Server side we only can ask Minikube nicely and document it ourselves.

@yangjunmyfm192085
Copy link
Contributor

Yeah, we should document it as a known issue and I'll update the known issue.

@marc-wilson
Copy link

Is there an equivalent setting for docker desktop? Having the same issue.

@hecheng64
Copy link

Yeah, we should document it as a known issue and I'll update the known issue.

How to solve this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

No branches or pull requests

6 participants