I need to run a scheduled cron task in kubernetes to take mongodb back up and upload it to S3 bucket. Looking for a way to do it just via yaml file.
I would suggest you to use mgob which provide a yaml file for backup and upload it to S3 Object Storage.Moreover, it bring monitoring as well as notification feature. It can also be deployed on k8s.
A step by step guide on running MGOB as a StatefulSet with PersistentVolumeClaims can be found here