Skip to content

Add metric for pod terminationGracePeriodSeconds #2992

Description

@tdriscoll

What would you like to be added:
I would like terminationGracePeriodSeconds to be exposed as a metric.

Why is this needed:
I need to monitor if a pod is approaching the termination grace period. My plan is to compare the deletion timestamp to the grace period. Something like this:
(time() - kube_pod_deletion_timestamp) > on(pod, namespace) kube_pod_spec_termination_grace_period_seconds

This will help us determine if pods are being killed (or close to be killed) because they exceed their grace period. This is useful because if the pod does not shut down gracefully it can be disruptive to our users.

Describe the solution you'd like:
One option is adding a new metric called kube_pod_spec_termination_grace_period_seconds. I am flexible to whatever y'all prefer. I tried adding as a custom metric but that is not supported for pods because the group is blank (i believe that is by design per #2044 (comment)) .

Additional context:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    Status
    Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions