Closed hjacobs closed 4 years ago
To delete all unused PVCs, use a rules file (--rules-file
option) with the following contents:
rules:
- id: remove-unused-pvcs
resources:
- persistentvolumeclaims
jmespath: "_context.pvc_is_not_mounted && _context.pvc_is_not_referenced"
ttl: 24h
Follow-up: #65, #66
Kubernetes Janitor should allow deleting PersistentVolumeClaims which are no longer mounted or referenced, e.g. because the StatefulSet was deleted.
PVCs are not automatically deleted and it's easy to forget them. From https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/:
Idea: add additional context properties which can be used in the rule
jmespath
.