-
Notifications
You must be signed in to change notification settings - Fork 57
docs(doc-1494): add data volumes and network attachment definitions pages #2338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
djwfyi
wants to merge
3
commits into
main
Choose a base branch
from
DOC-1494/data-volumes-nas-definitions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+550
−1
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,315 @@ | ||
| --- | ||
| title: Data volumes | ||
| sidebar_label: Data volumes | ||
| sidebar_position: 2 | ||
| sidebar_class_name: pro | ||
| --- | ||
|
|
||
| import Flow, {Step} from "@site/src/components/Flow"; | ||
| import FeatureTable from '@site/src/components/FeatureTable'; | ||
| import NavStep from "@site/src/components/NavStep"; | ||
| import Button from "@site/src/components/Button"; | ||
| import Label from "@site/src/components/Label"; | ||
|
|
||
| <FeatureTable names="vm-management" /> | ||
|
|
||
| KubeVirt `DataVolume` resources define the disk content that Containerized Data Importer (CDI) imports, clones, or creates for virtual machines. | ||
| In vCluster Platform, administrators use DataVolumes to prepare reusable VM disks, inspect import progress, and understand which VMs depend on a disk. | ||
|
|
||
| Open the DataVolumes view from **Virtual Machines > Data Volumes**, or go directly to `/virtual-machines/data-volumes`. | ||
|
|
||
| ## When to use data volumes | ||
|
|
||
| Use DataVolumes when you need to: | ||
|
|
||
| - Import a VM disk from an HTTP, HTTPS, or registry source. | ||
| - Clone disk content from an existing PVC. | ||
| - Create a blank disk that a VM can format and use. | ||
| - Track the import, clone, or population status of a VM disk across connected KubeVirt clusters. | ||
| - Identify VMs that reference a DataVolume before changing or deleting it. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before creating or using DataVolumes, make sure: | ||
|
|
||
| - The target Control Plane Cluster is [connected to vCluster Platform](../clusters/connect-cluster.mdx). | ||
| - KubeVirt and CDI are installed on the target cluster, or the [KubeVirt node provider is configured to deploy them](../node-providers/kubevirt.mdx#infrastructure-deployment). | ||
| - The user has permission to list, create, update, and delete `datavolumes.cdi.kubevirt.io` resources in the target namespace. | ||
| - The StorageClass used by the DataVolume can provision PVCs in the target cluster. | ||
| - Image URLs, registries, PVC sources, secrets, and certificates are reachable from CDI importer pods. | ||
|
|
||
| ## Create a standalone data volume | ||
|
|
||
| :::tip | ||
| Root disk DataVolumes for KubeVirt-backed Machines are usually generated automatically from [image properties](../node-providers/kubevirt.mdx#image-configuration) or an [OS image](../../use-platform/machines/os-images.mdx). Use the steps below to create a standalone DataVolume for reusable, secondary, or manually managed disks. | ||
| ::: | ||
|
|
||
| Use the platform UI when you want an administrator-managed DataVolume that can be referenced by one or more VMs. | ||
|
|
||
| <Flow> | ||
| <Step> | ||
| Open <NavStep>Virtual Machines</NavStep> > <NavStep>Data Volumes</NavStep>. | ||
| </Step> | ||
|
|
||
| <Step> | ||
| Click <Button>Create Data Volume</Button>. | ||
| </Step> | ||
|
|
||
| <Step> | ||
| Choose the target KubeVirt cluster and namespace. | ||
| </Step> | ||
|
|
||
| <Step> | ||
| Enter a name and storage size. | ||
| Select one source type: | ||
|
|
||
| - <Label>HTTP</Label>: import from an HTTP or HTTPS image URL. | ||
| - <Label>Registry</Label>: import from a container registry URL such as `docker://quay.io/containerdisks/ubuntu:22.04`. | ||
| - <Label>PVC</Label>: clone from an existing PVC. | ||
| - <Label>Blank</Label>: create an empty disk. | ||
| </Step> | ||
|
|
||
| <Step> | ||
| Click <Button>Save</Button> and watch its lifecycle in the table. | ||
| </Step> | ||
| </Flow> | ||
|
|
||
| See the [CDI documentation](https://kubevirt.io/user-guide/storage/containerized_data_importer/) for the full set of source types and import semantics. | ||
|
|
||
| The DataVolumes table shows the cluster, namespace, source type, requested storage, platform lifecycle status, and owner VMs. | ||
| Owner VMs appear when a VM references the volume. | ||
|
|
||
| ## Create a reusable data source | ||
|
|
||
| To let multiple VMs reuse the same disk content without importing it more than once, wrap a DataVolume's PVC in a CDI `DataSource`. | ||
| Import or clone the disk once into a DataVolume through the platform UI, then create a `DataSource` that points to the resulting PVC: | ||
|
|
||
| ```yaml | ||
| apiVersion: cdi.kubevirt.io/v1beta1 | ||
| kind: DataSource | ||
| metadata: | ||
| name: ubuntu-22-04 | ||
| namespace: golden-images | ||
| spec: | ||
| source: | ||
| pvc: | ||
| name: ubuntu-root-disk | ||
| namespace: golden-images | ||
| ``` | ||
|
|
||
| Reference the DataSource from a NodeProvider, NodeType, NodeClaim, or Machine with `kubevirt.vcluster.com/image-datasource`, the same property described in [Import a root disk through a Machine](#import-a-root-disk-through-a-machine). | ||
|
|
||
| vCluster Platform doesn't create or manage DataSource resources directly. Create and update them with `kubectl`, and treat them as long-lived golden images. | ||
| Deleting the underlying DataVolume or PVC breaks every VM that references the DataSource. | ||
|
|
||
| ## Understand the data volume lifecycle | ||
|
|
||
| CDI reports the raw lifecycle in the DataVolume `.status.phase` field. | ||
| vCluster Platform maps that to a simplified **Status** column that groups related CDI phases. | ||
| Use the CDI phase when you troubleshoot with `kubectl`. Use the platform status when you scan the UI. | ||
|
|
||
| | Platform status | Common CDI phases or signals | Meaning | | ||
| |---|---|---| | ||
| | `Importing` | `ImportScheduled`, `ImportInProgress` | CDI scheduled or started an image import. | | ||
| | `Pending` | `Pending`, `PVCBound`, clone phases, upload phases, `WaitForFirstConsumer`, `PendingPopulation` | CDI or the storage provider is preparing the PVC or waiting for scheduling. | | ||
| | `Ready` | `Succeeded` | CDI finished preparing the volume. | | ||
| | `Failed` | `Failed` or a `Running` condition with reason `Error` | CDI or the storage provider reported an error. | | ||
| | `Paused` | `Paused` | CDI paused the operation. | | ||
| | `Terminating` | `metadata.deletionTimestamp` is set | Kubernetes is deleting the DataVolume. | | ||
| | `Unknown` | Missing, empty, or unrecognized phase | The platform can't classify the lifecycle state. | | ||
|
|
||
| For example, the UI can show `Pending` for a DataVolume whose CDI phase is `WaitForFirstConsumer`. | ||
| That usually means the PVC waits for a VM pod to schedule before the storage provider binds it. | ||
|
|
||
| ## Use data volumes with node providers | ||
|
|
||
| The [KubeVirt node provider](../node-providers/kubevirt.mdx) can also synthesize a root-disk `DataVolumeTemplate` automatically when a Machine, NodeType, NodeProvider, or [OS image](../../use-platform/machines/os-images.mdx) sets `kubevirt.vcluster.com/image-url` or `kubevirt.vcluster.com/image-datasource`. | ||
| That generated DataVolume appears in the DataVolumes table alongside any administrator-created volumes. | ||
|
|
||
| ### Import a root disk through a Machine | ||
|
|
||
| For VM-backed Machines and auto nodes, you usually do not need to create the root DataVolume manually. | ||
| Instead, set image properties on the KubeVirt provider, node type, NodeClaim, Machine, or referenced OSImage. | ||
|
|
||
| ```yaml | ||
| apiVersion: management.loft.sh/v1 | ||
| kind: NodeProvider | ||
| metadata: | ||
| name: kubevirt-provider | ||
| spec: | ||
| properties: | ||
| kubevirt.vcluster.com/image-url: docker://quay.io/containerdisks/ubuntu:22.04 | ||
| kubevirt.vcluster.com/root-disk-size: 20Gi | ||
| kubeVirt: | ||
| clusterRef: | ||
| cluster: kubevirt-host | ||
| namespace: vcluster-platform | ||
| virtualMachineTemplate: | ||
| spec: | ||
| template: | ||
| spec: | ||
| domain: | ||
| resources: | ||
| requests: | ||
| cpu: "2" | ||
| memory: 4Gi | ||
| nodeTypes: | ||
| - name: ubuntu | ||
| maxCapacity: 10 | ||
| ``` | ||
|
|
||
| The provider creates a root-disk `DataVolumeTemplate`, a volume, and a disk for the VM. | ||
| HTTP and HTTPS image URLs become CDI `http` sources. | ||
| `docker://` image URLs become CDI `registry` sources. | ||
|
|
||
| To use a prepared CDI `DataSource`, set `kubevirt.vcluster.com/image-datasource` instead: | ||
|
|
||
| ```yaml | ||
| spec: | ||
| properties: | ||
| kubevirt.vcluster.com/image-datasource: golden-images/ubuntu-22-04 | ||
| kubevirt.vcluster.com/root-disk-size: 20Gi | ||
| ``` | ||
|
|
||
| Use `<name>` to reference a DataSource in the VM namespace, or `<namespace>/<name>` to reference one in another namespace. | ||
| Do not set `kubevirt.vcluster.com/image-url` and `kubevirt.vcluster.com/image-datasource` together. | ||
|
|
||
| ### Attach data volumes to VM templates | ||
|
|
||
| You can attach additional DataVolumes by adding a KubeVirt volume and disk to the VM template. | ||
| Use `dataVolumeTemplates` for volumes that should be created with the VM, or reference an existing DataVolume by name. | ||
|
|
||
| Use `dataVolumeTemplates` for inline volumes: | ||
|
|
||
| ```yaml | ||
| spec: | ||
| kubeVirt: | ||
| virtualMachineTemplate: | ||
| spec: | ||
| dataVolumeTemplates: | ||
| - metadata: | ||
| name: tools-disk | ||
| spec: | ||
| source: | ||
| blank: {} | ||
| pvc: | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| resources: | ||
| requests: | ||
| storage: 10Gi | ||
| template: | ||
| spec: | ||
| domain: | ||
| devices: | ||
| disks: | ||
| - name: tools-disk | ||
| disk: | ||
| bus: virtio | ||
| volumes: | ||
| - name: tools-disk | ||
| dataVolume: | ||
| name: tools-disk | ||
| ``` | ||
|
|
||
| When the KubeVirt node provider creates a VM from a template, it prefixes user-provided `dataVolumeTemplates` so DataVolume names stay unique for each node. | ||
|
|
||
| To attach a standalone DataVolume that already exists in the VM namespace, reference it from the VM template's `volumes` list: | ||
|
|
||
| ```yaml | ||
| spec: | ||
| kubeVirt: | ||
| virtualMachineTemplate: | ||
| spec: | ||
| template: | ||
| spec: | ||
| domain: | ||
| devices: | ||
| disks: | ||
| - name: my-data-disk | ||
| disk: | ||
| bus: virtio | ||
| volumes: | ||
| - name: my-data-disk | ||
| dataVolume: | ||
| name: my-existing-datavolume | ||
| ``` | ||
|
|
||
| The referenced DataVolume must exist in the namespace where KubeVirt creates the VM. | ||
| This is the path to use for DataVolumes created through the **Data Volumes** UI. | ||
|
|
||
| ## Operational ownership | ||
|
|
||
| DataVolumes are cluster resources, not vCluster Platform resources. | ||
| vCluster Platform gives administrators a UI for the connected KubeVirt clusters, but CDI owns the import and PVC population process. | ||
| KubeVirt owns DataVolumes created from a VM's `dataVolumeTemplates`, and those resources usually follow the VM lifecycle. | ||
|
|
||
| Use this ownership model: | ||
|
|
||
| | Owner | Responsibility | | ||
| |---|---| | ||
| | Platform administrator | Create reusable DataVolumes, choose storage classes, configure image sources, and control RBAC. | | ||
| | vCluster Platform | Lists DataVolumes, creates administrator-requested DataVolumes, shows platform lifecycle status and owner VMs, and generates root-disk templates from KubeVirt image properties. | | ||
| | CDI | Imports, clones, uploads, or populates PVC content and reports DataVolume phase and conditions. | | ||
| | KubeVirt | Creates DataVolumes from VM templates and attaches the resulting PVCs to VMs. | | ||
| | Storage provider | Provisions PVCs and enforces access modes, binding mode, expansion, and quota. | | ||
|
|
||
| Before deleting a DataVolume, check the **Owner VMs** column or inspect VM volumes with `kubectl`. | ||
| Deleting a DataVolume or its PVC while a VM references it can prevent the VM from starting or can detach required disk content. | ||
|
|
||
| ## Troubleshoot data volumes | ||
|
|
||
| ### Import is stuck or slow | ||
|
|
||
| Check the raw CDI phase and DataVolume conditions in the namespace where the DataVolume was created: | ||
|
|
||
| ```bash | ||
| kubectl get datavolume -n vcluster-platform | ||
| kubectl describe datavolume -n vcluster-platform ubuntu-root-disk | ||
| ``` | ||
|
|
||
| If the phase stays `ImportScheduled`, `ImportInProgress`, `WaitForFirstConsumer`, or `PendingPopulation`, inspect CDI importer pods and PVC events. | ||
|
|
||
| ```bash | ||
| kubectl get pods -n vcluster-platform -l cdi.kubevirt.io | ||
| kubectl describe pvc -n vcluster-platform ubuntu-root-disk | ||
| ``` | ||
|
|
||
| Common causes are an unreachable image URL, missing registry credentials, an invalid certificate ConfigMap, storage quota, an unavailable StorageClass, or a StorageClass with `WaitForFirstConsumer` binding that needs the VM pod to schedule before the PVC binds. | ||
|
|
||
| ### Data source can't be resolved | ||
|
|
||
| If a VM or Machine uses `kubevirt.vcluster.com/image-datasource`, verify the DataSource exists in the expected namespace: | ||
|
|
||
| ```bash | ||
| kubectl get datasource -A | ||
| kubectl describe datasource -n golden-images ubuntu-22-04 | ||
| ``` | ||
|
|
||
| Use `name` for a DataSource in the VM namespace and `namespace/name` for a DataSource in a different namespace. | ||
| Also confirm the referenced DataSource points to a valid PVC or VolumeSnapshot and that RBAC allows CDI and KubeVirt to read it. | ||
|
|
||
| ### Virtual machine console opens but the guest doesn't boot | ||
|
|
||
| Inspect the VM's disks and DataVolumes: | ||
|
|
||
| ```bash | ||
| kubectl get vm -n vcluster-platform my-vm -o yaml | ||
| kubectl get datavolume -n vcluster-platform | ||
| ``` | ||
|
|
||
| The root disk must be present in both `spec.template.spec.domain.devices.disks` and `spec.template.spec.volumes`. | ||
| For provider-generated root disks, `kubevirt.vcluster.com/root-disk-size` is required whenever `kubevirt.vcluster.com/image-url` or `kubevirt.vcluster.com/image-datasource` is set. | ||
| If the image boots but does not join a tenant cluster, make sure the guest image supports `cloudInitNoCloud`. | ||
|
|
||
| ### Data volume fails | ||
|
|
||
| Describe the DataVolume and review CDI importer logs: | ||
|
|
||
| ```bash | ||
| kubectl describe datavolume -n vcluster-platform ubuntu-root-disk | ||
| kubectl logs -n vcluster-platform -l cdi.kubevirt.io | ||
| ``` | ||
|
|
||
| Failures usually point to source access, authentication, checksum mismatch, unsupported image format, insufficient storage, or storage provider errors. | ||
| After correcting the source or storage issue, recreate the DataVolume if CDI cannot retry the failed import. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.