Open runningman84 opened 5 years ago
I think this feature would be really great.
Hello, I think this is possible.
You can use the setup
and teardown
bash scripts to create subvolumes.
Requirements: local-path-provisioner version >= v0.0.15
Steps:
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
to get the local-path-provisioner into you kubernetes cluster. btrfs
tools, make sure you are using a helper image which has those tools available. By default local-path-provisioner uses busybox
docker image. To change this kubectl edit deployments.apps -n local-path-storage local-path-provisioner
and edit the container templates command. Append it with e.g. alpine linux image.kubectl edit configmaps local-path-config -n local-path-storage
in the data object there edit setup and teardown as wished. eg.
setup: |-
#!/bin/sh
path=$1
echo "$@"
apk add btrfs-progs
btrfs subvolume create ${path}
teardown: |-
#!/bin/sh
path=$1
rm -rf ${path}
For now it seems not possible to get btrfs subvolume delete ${path}
working. I think the helper image hast to run as privileged or need some capabilities.
I hope that helps.
Is there also an environment variable for the quota in the setup
script?
I think btrfs subvolumes still need to be supported directly in local-path-provisioner (or similar project) in order to integrate it with the volume snapshot API, right?
I'm glad to see there is some interest on this topic.
@dvonessen What needs to be done in order to integrate this with the volume snapshot API?
@dvonessen I can look into the permissions problems, As I've started to look into this issue it appears that there is a btrfs storage driver for docker. I plan on diving into the volume snapshot api later this week, but in the interim I came across the ember-csi which appears to have btrfs support in some capacity. Not sure if either of these will be of use, but they may provide context to solve the problem.
The btrfs storage driver for docker is about storing images, not volumes.
Any updates on this? What needs to be done?
Any update/plans?
I have been working on a simple btrfs provisioner: https://github.com/timoschwarzer/btrfs-provisioner I eventually want to add support for automatic node selection, moving volumes between nodes (using btrfs send/receive) and more in the future.
It would be great if the provisioner could create a btrfs subvolume with quota for each PVC.
This would also give us snapshot and backup functionality using btrfs tools.