Resolve k3s on VM β Disk High Latency / Slow IOPS
Summaryβ
VMs running k3s exhibit abnormally high disk latency and degraded IOPS when their Ceph-backed block volume was cloned from a snapshot and the RBD image has not been flattened. Every write operation incurs copy-on-write overhead against the parent snapshot, saturating I/O even when disk tilisation appears low. Running fstrim does not resolve the issue. Flattening the RBD image resolves the issue.
Detailsβ
Use the following symptoms to confirm this KB applies to your environment.
- Symptom A β Disk shows low utilisation but high latency:
df -hreports normal usage (e.g. 13% on a 200 GiB volume), yet applications experience slow read/write performance. - Symptom B β Ceph volume has an active parent reference:
rbd infoshows aparent:field pointing to a snapshot, andrbd dureportsUSEDclose toPROVISIONEDdespite low guest-side utilisation. - Symptom C β
fstrimproduces no improvement: Runningfstrim -avon the guest completes without error but latency remains unchanged. - Root Cause: The Ceph RBD volume was cloned from a snapshot and the image was never flattened. All writes trigger copy-on-write against the parent snapshot chain, which adds significant latency and reduces effective IOPS.
Confirming the parent referenceβ
Run the following on the Ceph cluster to check for a parent relationship:
rbd du cinder-volumes/<volume-id>
If the output contains a parent: line (as shown below), the volume is still linked to its snapshot origin and must be flattened.
parent: cinder-volumes/volume-04d1fa55-7990-43a9-8018-9c1658fe87f9@snapshot-46874354-44b6-448e-be22-daa70ef24fc0
overlap: 200 GiB
Applicable versionsβ
All CubeCOS versions.
Resolutionβ
Choose the remediation path that best fits your deployment schedule.
Option 1: Flatten the RBD image (Recommended β support action)β
Flattening the image severs the parent-snapshot dependency. All data is copied into the volume itself, eliminating copy-on-write overhead. This operation runs online and does not require a VM reboot, but it will temporarily increase Ceph I/O during the copy.
Run the following on the Ceph cluster:
rbd flatten cinder-volumes/<volume-id>
Monitor progress until completion:
Image flatten: 100% complete...done.
Once flattened, verify that rbd info no longer shows a parent: field.
Disk latency should return to baseline levels immediately.
Option 2: Redirect k3s data directory (User-side workaround)β
If flattening is not immediately possible, you can reduce the impact by pointing k3s to a volume or path with lower latency. Use the --data-dir flag at server startup to specify an alternative location:
k3s server --data-dir /path/to/fast-volume/k3s
Refer to the k3s server CLI reference for full details on the --data-dir option and supported paths.
Additional informationβ
- The copy-on-write penalty is proportional to the overlap between the child volume and its parent snapshot. Large overlaps (e.g. 200 GiB as shown in
rbd du) produce the most severe latency impact. fstrimoperates at the filesystem/guest level and has no effect on Ceph-layer copy-on-write chains. This is expected behaviour.- RBD image features such as
object-mapandfast-diff(present in the example above) are not a contributing cause and do not need to be disabled.
What's nextβ
After flattening the RBD image:
- Verify baseline IOPS using
fiooriostaton the guest to confirm latency has returned to expected levels. - Review your volume provisioning workflow to ensure future clones are flattened before being attached to production workloads.
- If multiple VMs show similar symptoms, audit all Ceph volumes for active parent references using
rbd lsandrbd info.