Kubernetes Pod Logs purging Mechanism

Hello,

I am looking for a mechanism or method to delete the Kubernetes pod logs in an interval of 1 day without restarting the pod.

Is there any purging Mechanism?

Looks like there’s been a mechanism since around K8s v1.21; there are configuration options on Kubelet that you can set to do that.

You may also need to use some kind of cron script to delete the logs from the node’s disk space. The exact location may vary depending on what CRI you are using, but by configuration log rotation for those files, you can make sure they are unavailable via kubectl logs

logging-node-level