Skip to main content

Verify Pod Runtime Duration

Type: Rule
ID: k8s-pods-verify-pod-duration
Source: v2/rules/k8s/pods/verify-pod-duration.yaml
Rego Source: verify-pod-duration.rego
Labels: K8s, Pod

Verify Kubernetes pods adhere to a specified runtime duration to enforce lifecycle limits.

note

This rule requires K8s Pod Discovery Evidence. See here for more details.

tip

Signed Evidence for this rule IS NOT required by default but is recommended.

warning

Rule requires evaluation with a target. Without one, it will be disabled unless the --all-evidence flag is provided.

Usage example

uses: k8s/pods/verify-pod-duration@v2
with:
max_days: 30

Mitigation

Ensures that pods do not exceed their intended lifecycle, maintaining cluster hygiene and resource efficiency.

Description

This rule verifies that the duration of pods in Kubernetes does not exceed the specified limit. It performs the following steps:

  1. Iterates over the pods in the cluster.
  2. Checks each pod's duration against the limit specified in the with.max_days configuration.
    • If a pod's duration exceeds the limit, the rule flags it as a violation.

Evidence Requirements:

  • Evidence must be provided by the Scribe Platform's CLI tool through scanning Kubernetes resources.

Evidence Requirements

FieldValue
signedFalse
content_body_typegeneric
target_typedata
predicate_typehttp://scribesecurity.com/evidence/discovery/v0.1
labels- asset_type=pod
- platform=k8s

Input Definitions

ParameterTypeRequiredDescription
max_daysintegerFalseThe maximum allowed duration for pods in days.