Mukund Sharma
Mukund Sharma

Reputation: 107

Calculate the availability of a pod in kubernetes over a period of time

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

Answers (1)

Mukund Sharma
Mukund Sharma

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

Related Questions