Example of a pod definition for a Ceph RBD

Example of a pod definition for a Ceph RBDΒΆ

If your virtual machines store data in Ceph, you can attach Ceph RBDs to the virtual machines under Kubernetes control by specifying the required RBDs in the virtual machine pod definition. You do not need to mount the devices in the container.

Virtlet supports the following options for Ceph RBD devices:

Option

Paramater

FlexVolume driver

kubernetes.io/flexvolume_driver

Type

ceph

Monitor

ip:port

User

user-name

Secret

user-secret-key

Volume

rbd-image-name

Pool

pool-name

The following text is an example of a virtual machine pod definition with one Ceph RBD volume:

apiVersion: v1
kind: Pod
metadata:
  name: cirros-vm-rbd
  annotations:
    kubernetes.io/target-runtime: virtlet
spec:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: extraRuntime
            operator: In
            values:
          - virtlet
containers:
  - name: cirros-vm-rbd
    image: virtlet/image-service.kube-system/cirros
    volumeMounts:
    - name: test
      mountPath: /testvol
volumes:
  - name: test
    flexVolume:
      driver: kubernetes.io/flexvolume_driver
      options:
        Type: ceph
        Monitor: 10.192.0.1:6789
        User: libvirt
        Secret: AQDTwuVY8rA8HxAAthwOKaQPr0hRc7kCmR/9Qg==
        Volume: rbd-test-image
        Pool: libvirt-pool