<p>What is the simplest way to find out the Availability of a K8s service over a period of time, lets say 24h. Should I target a pod or find a way to calculate service reachability</p>

<p>I'd recommend to not approach it from a binary (is it up or down) but from a &quot;how long does it take to serve requests&quot; perspective. In other words, phrase your availability in terms of SLOs. You can get a very nice automatically generated SLO-based alter rules from <a href="https://promtools.dev/alerts/latency" rel="nofollow noreferrer">PromTools</a>. One concrete example rule from there, showing the PromQL part:</p>
<pre class="lang-yaml prettyprint-override"><code>1 - (
 sum(rate(http_request_duration_seconds_bucket{job=&quot;prometheus&quot;,le=&quot;0.10000000000000001&quot;,code!~&quot;5..&quot;}[30m]))
 /
 sum(rate(http_request_duration_seconds_count{job=&quot;prometheus&quot;}[30m]))
)
</code></pre>
<p>Above captures the ratio of how long it took the service to serve non-500 (non-server errors, that is, assumed good responses) in less than 100ms to overall responses over the last 30 min with <code>http_request_duration_seconds</code> being the histogram, capturing the distribution of the requests of your service.</p>
