Since Kubernetes will make Secrets volume to be mounted as read-only, when mc-backup is trying to run mkdir in this line, our pod will show the following error:
2024-06-22T00:59:20+0800 INFO sleeping 24h...
2024/06/22 00:59:24 ERROR : Failed to save config after 10 tries: failed to create temp file for new config: open /config/rclone/rclone.conf59648627: read-only file system
To fix this issue, we can create a new empty volume and use InitContainer to copy the content of the Secrets volume to the new volume. Then we can mount the new volume as read-write in the main container.
Proven Image
I've tested this on my environment and now my mc-backup pod can successfully upload the backup to my drive using rclone.
Description
Since Kubernetes will make Secrets volume to be mounted as read-only, when mc-backup is trying to run
mkdir
in this line, our pod will show the following error:To fix this issue, we can create a new empty volume and use InitContainer to copy the content of the Secrets volume to the new volume. Then we can mount the new volume as read-write in the main container.
Proven Image
I've tested this on my environment and now my
mc-backup
pod can successfully upload the backup to my drive usingrclone
.