docs/doc/source/kube-virt/set-up-cdi-proxy-ad165d884417.rst
Ron Stone cf755b146c KubeVirt/CDI introduction
Inital draft guide for KubeVirt introduction
Conditionalize version
Implement patchset 2 review changes
Implement patchset 3 review changes
Resolve merge conflict
Implement patchset 4 review changes

Story: 2010466

Signed-off-by: Ron Stone <ronald.stone@windriver.com>
Change-Id: I57a16fca9b78992b249a1aa04e6b12893c94fe9f
2022-12-16 19:32:48 -05:00

2.3 KiB

Set up CDI Proxy

The Containerized Data Importer () project provides facilities for enabling to be used as disks for KubeVirt by way of DataVolumes.

The service is installed as part of uploading and applying the KubeVirt system application. The most common use case for is 'uploading a disk image to a DataVolume'. To use the service, your Kubernetes cluster-admin should make the cdi-uploadproxy service accessible from outside the cluster. This can be done via NodePort service or Ingress service.

Configuring the NodePort service option is shown below:

  1. Create the proxy yaml configuration.

    $ cat <<EOF > cdi-uploadproxy-nodeport-service.yaml apiVersion: v1
    kind: Service
    metadata:
      name: cdi-uploadproxy-nodeport
      namespace: cdi
      labels:
        cdi.kubevirt.io: "cdi-uploadproxy"
    spec:
      type: NodePort
      ports:
        - port: 443
        targetPort: 8443
        nodePort: 32111 # Use unused nodeport in 31,500 to 32,767 range 
        protocol: TCP
    selector:
      cdi.kubevirt.io: cdi-uploadproxy
    EOF
  2. Apply the configuration.

    $ kubectl apply -f cdi-uploadproxy-nodeport-service.yaml

Now the virtctl command can be used to upload a image file into an existing or new DataVolume ().

See the example (create-an-ubuntu-vm-fafb82ec424b) that uploads an ubuntu cloud image (jammy-server-cloudimg-amd64.img from https://cloud-images.ubuntu.com/jammy/current/) into a new 500G DataVolume named stx-lab-jenkins-disk:

$ virtctl image-upload dv stx-lab-jenkins-disk -n jenkins-ns --insecure \
  --access-mode ReadWriteOnce --size 500Gi --image-path \
  /home/sysadmin/admin/kubevirt/images/jammy-server-cloudimg-amd64.img     \
  --uploadproxy-url https://admin.starlingx.abc.com:32111

See sections on create-an-ubuntu-vm-fafb82ec424b and create-a-windows-vm-82957181df02 on how to then use this DataVolume to create/launch a .

See https://kubevirt.io/user-guide/operations/containerized_data_importer/ for more details and other use cases.