Skip to content

CVMFS

CVMFS

If not explicitly disabled, clusters deployed with Magnum support mounting CVMFS volumes.

Below we give examples of how to do it in each different container engine.

Docker Swarm

Example creating a swarm service using the repository cms.cern.ch (repo name goes in option source):

$ docker service create --mount 'type=volume,volume-driver=cvmfs,source=cms.cern.ch,destination=/cvmfs/cms.cern.ch' busybox sleep 10000

You can also pass a specify CVMFS repository tag or a hash on creation.

$ docker service create --mount 'type=volume,volume-driver=cvmfs,source=cms.cern.ch@trunk-previous,destination=/cvmfs/cms.cern.ch' busybox sleep 10000

Example mounting hash SOMEHASH:

$ docker service create --mount 'type=volume,volume-driver=cvmfs,source=cms.cern.ch@trunk-previous,destination=/cvmfs/cms.cern.ch' busybox sleep 10000

You can also launch a single container passing a cvmfs repository:

docker run -it --volume-driver cvmfs -v cms.cern.ch:/cvmfs/cms.cern.ch busybox sh

Kubernetes

For kubernetes we rely on the csi-cvmfs driver.

NOTE: For kubernetes versions 1.13 or earlier the provisioner field in the StorageClass below should be csi-cvmfsplugin

Here's an example mounting the cms.cern.ch cvmfs repo (we use the nginx server for convenience):

$ cat nginx-cvmfs.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: csi-cvmfs-cms
provisioner: cvmfs.csi.cern.ch
parameters:
  repository: cms.cern.ch
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: csi-cvmfs-cms-pvc
spec:
  accessModes:
  - ReadOnlyMany
  resources:
    requests:
      storage: 1Gi
  storageClassName: csi-cvmfs-cms
---
apiVersion: v1
kind: Pod
metadata:
  name: web-server
spec:
  containers:
   - name: web-server
     image: nginx
     volumeMounts:
       - mountPath: /cvmfs/cms.cern.ch
         name: cms-pvc
  volumes:
   - name: cms-pvc
     persistentVolumeClaim:
       claimName: csi-cvmfs-cms-pvc
       readOnly: true

You can define the mount location on the volumeMounts part of the Pod definition (in this case it was /cvmfs/cms.cern.ch). The storage size parameter is irrelevant for CVMFS volumes, the value is ignored (1Gi in the case above).

If you want to mount a specific CVMFS repository tag or a hash simply add @TAGNAME or #SOMEHASH to the repository name, as in cms.cern.ch@trunk-previous.


Last update: October 7, 2019