ploop-flexvol
A FlexVolume driver for kubernetes which allows you to mount Ploop volumes to your kubernetes pods.
Status
Kubernetes FlexVolumes are currently in Alpha state, so this plugin is as well. Use it at your own risk.
Using
Build
mkdir -p src/github.com/virtuozzo
ln -s ../../../ src/github.com/virtuozzo/ploop-flexvol
export GOPATH=`pwd`
cd src/github.com/virtuozzo/ploop-flexvol
make
Installing
In order to use the flexvolume driver, you'll need to install it on every node you want to use ploop on in the kubelet volume-plugin-dir
. By default this is /usr/libexec/kubernetes/kubelet-plugins/volume/exec/
You need a directory for the volume driver vendor, so create it:
mkdir -p /usr/libexec/kubernetes/kubelet-plugins/volume/exec/virtuozzo~ploop
Then drop the binary in there:
mv ploop /usr/libexec/kubernetes/kubelet-plugins/volume/exec/virtuozzo~ploop/ploop
You can now use ploops as usual!
Pod Config
An example pod config would look like this:
apiVersion: v1
kind: Pod
metadata:
name: nginx-ploop
spec:
containers:
- name: nginx
image: nginx
volumeMounts:
- name: test
mountPath: /data
ports:
- containerPort: 80
nodeSelector:
os: parallels # make sure you label your nodes to be ploop compatible
volumes:
- name: test
flexVolume:
driver: "virtuozzo/ploop" # this must match your vendor dir
options:
volumeId: "golang-ploop-test"
size: "10G"
volumePath: "/vstorage/storage_pool/kubernetes"
This will create a ploop volume /vstorage/storage_pool/kubernetes/golang-ploop-test
. The block device which will be mounted will be at /vstorage/storage_pool/kubernetes/golang-ploop-test/golang-ploop-test
and the DiskDescriptor.xml
will be located at /vstorage/storage_pool/kubernetes/golang-ploop-test/DiskDescriptior.xml`
You can verify the ploop volume was created by finding the node where your pod was scheduled by running ploop list
:
# ploop list
ploop18115 /vstorage/storage_pool/kubernetes/golang-ploop-test/golang-ploop-test
Options
-
volumePath
a path to a virtuozzo storage directory where ploop will be created
-
volumeId
an unique name for a ploop image
-
size=[0-9]*[KMG]
size of the volume
-
vzsReplicas=normal[:min]|/X
Replication level specification:
normal The number of replicas to maintain.
minimum The minimum number of replicas required to write a file (optional).
/X Write tolerance (normal-minimum). The number of replicas allowed to go offline
provided that the client is still allowed to write the file.
The number of replicas must be in the range 1-64.
-
vzsEencoding=M+N[/X]
Encoding specification:
M The stripe-depth.
N The number of parity blocks.
X The write tolerance. The number of replicas allowed to go offline
provided that the client is still allowed to write the file.
-
vzsFailureDomain=disk|host|rack|row|room
Failure domain for file replicas.
This parameter controls how replicas are distributed across CSs in the cluster:
disk - place no more then 1 replica per disk/CS
host - place no more then 1 replica per host (default)
rack - place no more then 1 replica per RACK
row - place no more then 1 replica per ROW
room - place no more then 1 replica per ROOM
-
vzsTier=0-3
Storage tier for file replicas.