Skip to content

Gather metrics for pods that are scheduled. #10

@naved001

Description

@naved001

CPU_METRIC = 'kube_pod_resource_request{unit="cores"}'

This metric will gather cpu request by all pods regardless of if they are running or not.

So, if you had a pod that could not be scheduled we will still end up counting it's CPU requests.

I discovered this when I was trying to gather GPU usage data for the NERC openshift cluster, there was a pod that requested a GPU but it was never scheduled as the cluster does not have an active GPU.

One possible solution is to get an intersection like this:
https://github.com/naved001/xdmod-openshift-scripts/blob/d75e06698961a5b9f4db0ac4e86f4e11b30a41a8/openshift_metrics/openshift_prometheus_metrics.py#L26

it worked when I queried GPU metrics, but when I applied this intersection for CPU and Memory I got a 422 error code from prometheus and thanos. :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions