Is there a recommended way of copying files from a pod periodically. I have a pod with an empty storage and no persistence volume. So wanted to periodically copy some log files from the pod containers to a nfs share. I can run a cronjob and invoke kubectl copy but wondering if there is a better way of doing this?
Run a cronjob as a scheduled job to copy the files to target location
I think the better way for your case is to mount the NFS volume on your Pod to directly write the logs on it : https://kubernetes.io/docs/concepts/storage/volumes/#nfs