Skip to content

Commit b0f9227

Browse files
authored
Add cleanup job for evicted pods in example.yaml
Added a cleanup job for evicted pods with a TTL of 15 minutes.
1 parent 5e088f9 commit b0f9227

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

example.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,28 @@ rules:
5050
## run on all namespaces
5151
namespaceSelector: {}
5252

53+
# cleanup of evicted pods which are not yet removed by the Kubernetes control plane
54+
- id: CleanupEvictedPods
55+
## ttl, calculated against terminated.finishedAt
56+
ttl: 15m
57+
resources:
58+
- group: ""
59+
version: v1
60+
kind: pods
61+
62+
## get timestampo from containerStatuses if pod is terminated
63+
timestampPath: |-
64+
max(status.containerStatuses[*].lastState.terminated.finishedAt)
65+
66+
## filter only pods which are in phase "Failed" or "Succeeded"
67+
filterPath: |-
68+
status.reason == 'Evicted'
69+
70+
selector: {}
71+
72+
## run on all namespaces
73+
namespaceSelector: {}
74+
5375
- id: example
5476
# resources expires 1 hour after creation
5577
ttl: 1h

0 commit comments

Comments
 (0)