Reputation: 107
I need to calculate the availability of a pod in kubernetes over a period of time in percentage using PromQL. Any suggestions are welcome.
Upvotes: 0
Views: 1412
Reputation: 107
I was able to achieve it with below query:
(sum_over_time((sum(kube_pod_status_ready{cluster="$cluster",condition="true", namespace="$namespace"}))[$availability_span:5m])) / (sum_over_time((sum(kube_pod_status_ready{cluster="$cluster",namespace="$namespace"}))[$availability_span:5m])) * 100
Upvotes: 3