Regarding container creating during VMI create using kubevirt

11/9/2019

I am using kubernetes with docker. #kubectl, #Kubevirt

When I create a VMI using containerDisk from docker.io registry I have found there is two container creating inside single pod (one is compute and another is volumecontainervolume)

cat centos.yaml | grep -ia3 centos-kubevirt-image

 volumes:

  - name: containervolume

  containerDisk:

    image: munnaeeebd/centos-kubevirt-image:latest

 - name: cloudinitvolume

  cloudInitNoCloud:

    userData: |-

kubectl get pod | grep centos

virt-launcher-centos-5kfvw 2/2 Running 0 21h

But single container is create while using PVC and disk.img is uploaded via CDI

cat cirros-with-cirros-pvc.yaml | grep -ia3 cirros-pvc

  volumes:

   - name: containervolume

     persistentVolumeClaim:

     claimName: cirros-pvc

   - name: cloudinitvolume

     cloudInitNoCloud:

    userData: |-

kubectl get pod | grep cirros

virt-launcher-cirros-57x2r 1/1 Running 0 78m

my question is, is it normal that containerDisk create one additional container than PVC

-- Munna
docker
kubernetes
virtual-machine

1 Answer

11/12/2019

As explained in this GitHub post it is designed behavior.

The compute container contains the QEMU process with running Virtual Machine. The Virtual Machine reads the machine image from mounted volume served from the other volumecontainer.

The second container only provides the data.

With this design you have the benefit of packaging a Virtual Machine in the container image and uploading it to any container registry. Once it is uploaded, it can be used by KubeVirt as container disk.

-- KFC_
Source: StackOverflow