When I am trying to aggregate the data based on pod to namespace level it is not matching the data directly driven by namespace filter.
I want the pod specific data which matches the namespace data when got aggregated.
For namespace specific data I am using below four queries. (Which is giving me correct answer)
{"cpu_usage": f"sum_over_time(namespace:container_cpu_usage:sum{{namespace='{namespace}'}}[1d])",
"cpu_request":f"sum_over_time(namespace_cpu:kube_pod_container_resource_requests:sum{{namespace='{namespace}'}}[1d])",
"memory_usage":f"sum_over_time(namespace:container_memory_usage_bytes:sum{{namespace='{namespace}'}}[1d])",
"memory_request":f"sum_over_time(namespace_memory:kube_pod_container_resource_requests:sum{{namespace='{namespace}'}}[1d])"}
For pod specific data I am using below four queries. (When I aggregate this queries using sum (query) by (namespace) the result is not matching the above queries' readings.)
{"cpu_usage": f"sum_over_time(pod:container_cpu_usage:sum{{namespace='{namespace}'}}[1d])",
"cpu_request": f"sum_over_time(kube_pod_container_resource_requests{{namespace='{namespace}', resource = 'cpu'}}[1d])",
"memory_usage":f"sum(sum_over_time(container_memory_usage_bytes{{namespace='{namespace}', container!='POD', container!=''}}[1d])) by (pod)",
"memory_request": f"sum_over_time(kube_pod_container_resource_requests{{namespace='{namespace}', resource = 'memory'}}[1d])"}
tl;dr
I want the same data as I am getting for the whole namespace but I want to segregate the usage and request for the specific pods.
0 comments:
Post a Comment
Thanks