Skip to content

Conversation

@sprt
Copy link

@sprt sprt commented Nov 19, 2025

User-facing changes

  • Users need to specify the disk sizeLimit via an annotation because K8s doesn't pass the its sizeLimit parameter over CRI, e.g.:
  annotations:
    io.katacontainers.volumes.emptydir_sizelimit.scratch: 1G

Servicing changes

  • Add the below flag to containerd config so that containerd forwards the sizeLimit annotation to Kata:
 [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.kata]
   runtime_type = "io.containerd.kata.v2"
   privileged_without_host_devices = true
+  pod_annotations = ["io.katacontainers.volumes.emptydir_sizelimit.*"]

Current gaps with final implementation

  • Format fs in the guest instead of host
  • Kata config flag to enable block-based emptyDir
  • Policy support

Bugs

root@busybox:/scratch# dd if=/dev/zero of=output.bin bs=1M count=80 oflag=direct
command terminated with exit code 255

then df -hT shows virtiofs

Demo

# busy.yaml
apiVersion: v1
kind: Pod
metadata:
  name: busybox
  annotations:
    io.katacontainers.volumes.emptydir_sizelimit.scratch: 1G
spec:
  runtimeClassName: kata
  containers:
  - image: docker.io/library/busybox:latest
    name: container
    command: ["sleep", "inf"]
    volumeMounts:
    - name: scratch
      mountPath: /scratch
  volumes:
  - name: scratch
    emptyDir:
      sizeLimit: 1G # No effect with block-based

Below you notice that the mount source is ext4 (instead of virtiofs today) and the fs type is ext4 (instead of overlay today):

$ kubectl apply -f busy.yaml
pod/busybox created
$ kubectl exec -it busybox -c container -- df -hT | grep scratch
/dev/vdb             ext4          920.3M    260.0K    856.4M   0% /scratch

@sprt sprt changed the title Sprt/blk emptydir runtime: Implement MVP support for block-based emptyDir Nov 19, 2025
Apokleos and others added 2 commits November 20, 2025 13:21
As csi-directvolume-kata will use raw file on the host as the
backend of a virtio-blk block device, and it is treated as just a
regular file, which cause runtime label it unsupported device type.
To correct such case, this patch supports it.

Another important factor related to the issue kata-containers#11296, as it said that,
the Options with bind does cause it fail. But in my test with runtime-rs,
it works well. So in this patch, I just remove the related Option
assignment from the m.Option

Fixes kata-containers#11296

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
@sprt sprt force-pushed the sprt/blk-emptydir branch from 16fcf5d to 6e99628 Compare November 20, 2025 13:21
sprt added 5 commits December 4, 2025 14:44
Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants