Create a Job That Cleans Old Logs
beginner
15 minInstructions
Create a Kubernetes Job named log-cleaner
in the tools
namespace.
The container image is alpine:3.18
and it should run:
find /var/logs -type f -mtime +7 -delete
The logs are mounted from an existing PVC named logs-pvc
.
The pod should:
- Complete successfully.
- Not restart (set
restartPolicy
accordingly). - Mount the volume at
/var/logs
.