0

I'm trying to Use an Image Volume With a Pod, but having no luck. Wondering if someone has ever gotten it working?

My Setup:

bash-3.2$ minikube version
minikube version: v1.34.0
commit: 210b148df93a80eb872ecbeb7e35281b3c582c61
bash-3.2$ kubectl version
Client Version: v1.31.1
Kustomize Version: v5.4.2
Server Version: v1.31.0

I start Minikube with minikube start --feature-gates=ImageVolume=true

and confirm that ImageVolume feature is enabled:

bash-3.2$ kubectl get --raw /metrics | grep kubernetes_feature_enabled | grep -i imagevolume
kubernetes_feature_enabled{name="ImageVolume",stage="ALPHA"} 1

I tried to follow the example at Use an Image Volume With a Pod but step 1 (create the pod on your cluster fails):

bash-3.2$ kubectl apply -f https://k8s.io/examples/pods/image-volumes.yaml
pod/image-volume created
bash-3.2$ k get pods
NAME           READY   STATUS         RESTARTS   AGE
image-volume   0/1     ErrImagePull   0          7s
bash-3.2$ k describe pods image-volume

results in this error: Failed to pull image "quay.io/crio/artifact:v1": invalid rootfs in image configuration

I changed spec.volumes.image.reference to just use debian and then

bash-3.2$ k describe pods image-volume

results in Successfully pulled image "debian" in 607ms (607ms including waiting). Image size: 138845227 bytes. (yay!!)

but also Error: Error response from daemon: invalid volume specification: ':/volume'

I've tried with my own images and I always get the error invalid volume specification

I also tried to follow this Medium article - Kubernetes Image Volumes: A deep dive, but this seems to be doing things incorrectly since spec.volumes.imageVolume is wrong:

Pod in version "v1" cannot be handled as a Pod: strict decoding error: unknown field "spec.volumes[0].imageVolume"

I understand that ImageVolume is a new feature. But I hope someone has gotten it working. If so, can you please share a working example. Or help me figure out what's going wrong in my attempts?

Thanks!

1 Answers1

0

Minikube uses the container runtime of Docker. I tried running it with cri-o and containerd runtimes. Got different errors with both. It seems to me that while K8S specs contain this feature, the container runtimes don't support it. Yet. Maybe this will be supported in the future. Related comment: https://github.com/kubernetes/enhancements/pull/4897#issuecomment-2389455597