If you want to mount a block device that is available
in the /dev/
directory on the Kubernetes node,
you can specify the raw device in the pod definition.
The following text is an example of pod definition with
one block device. In this example, the path to the raw device
is /dev/loop0
which means that a disk is associated with
the path on the Virtlet node.
apiVersion: v1
kind: Pod
metadata:
name: test-vm-pod
annotations:
kubernetes.io/target-runtime: virtlet
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: extraRuntime
operator: In
values:
- virtlet
containers:
- name: test-vm
image: download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
volumeMounts:
- name: raw
mountPath: /rawvol
volumes:
- name: raw
flexVolume:
driver: "virtlet/flexvolume_driver"
options:
type: raw
path: /dev/loop0