I guess it goes through non-ready states while it's starting up.

A simple approach is to put "for: 3m" on the alert so that it doesn't fire 
an alert until it has been in the down state for 3 minutes.

Another approach would be:

kube_pod_status_ready{condition="true"} == 0 and 
max_over_time(kube_pod_status_ready{condition="true"}[10m]) == 1

This will fire if the pod was ready at any time in the last 10 minutes, but 
is not ready now. This does mean that the alert will clear after 10 minutes 
of error condition, though.

On Tuesday 13 February 2024 at 17:18:37 UTC sri L wrote:

> Hi all,
>
> I am trying to create an alert rule for pod unreachable condition. Below 
> expression I used but alert was triggering whenever new pod got created, we 
> want alert only when the previous state of a pod was in the ready state and 
> then went to unreachable/terminating/pending states.
>
> kube_pod_status_ready{condition="true"} == 0
>
> Please suggest if we have any suitable alert expression for the above 
> requirement.
>
> Thanks
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/7728c736-797f-4771-b809-24e5f6b3931dn%40googlegroups.com.

Reply via email to