Anyone know or can point me to where i could find how one can delete kuberenets resources based on Age? Iām trying to build a cron job that would delete old services, pods, jobs, configmaps of a specific namespace. So for example something that would get all pods that are 2 days old of a specific namespace and run a kubectl delete pods command based on that list? the below command will sort the pods based on the creation timestamp but what i really need is the ability to list & delete resources that are greater than a specified date.
kubectl get pods -n k6 --sort-by=.metadata.creationTimestamp -o jsonpath="{.items[0].metadata.name}"