I am new to k8s, but have been exploring persistent volumes, and the ability to actually limit capacity is only in alpha stage, and needs to be manually enabled to work per: https://kubernetes.io/docs/concepts/storage/storage-capacity/#enabling-storage-capacity-tracking
I'd much rather build a disk image file, such as:
fallocate -l 50M mytest.img
mke2fs -t ext4 mytest.img
And then mount it as a volume in a pod in k8s, but I am not sure how. I've tried using hostPath, but it failed when trying as a File and a Directory type. Considering the plethora of volume mounting types, hopefully I just am missing the proper command.
I know I can mount the image somewhere on the host and then point hostPath to the mount, but host mounting shouldn't be required.
Edit: If this isn't possible, can someone suggest an alternative image file type that I can create a limited (but expandable) file that is mountable in k8s?