Answers: <p>Minikube uses the container runtime of Docker.
  I tried running it with <code>cri-o</code> and <code>containerd</code> 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: <a href="https://github.com/kubernetes/enhancements/pull/4897#issuecomment-2389455597" rel="nofollow noreferrer">https://github.com/kubernetes/enhancements/pull/4897#issuecomment-2389455597</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2024-10-25T22:33:08.007Z
Answers: 2024-10-25T22:33:08.007Z
Answers: Abhishek Goel
Body: <p>I'm trying to <a href="https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/" rel="nofollow noreferrer">Use an Image Volume With a Pod</a>, but having no luck. Wondering if someone has ever gotten it working?</p>
  <p><strong>My Setup:</strong></p>
  <pre><code>bash-3.2$ minikube version
  minikube version: v1.34.0
  commit: 210b148df93a80eb872ecbeb7e35281b3c582c61
  </code></pre>
  <pre><code>bash-3.2$ kubectl version
  Client Version: v1.31.1
  Kustomize Version: v5.4.2
  Server Version: v1.31.0
  </code></pre>
  <p>I start Minikube with <code>minikube start --feature-gates=ImageVolume=true</code></p>
  <p>and confirm that ImageVolume feature is enabled:</p>
  <pre><code>bash-3.2$ kubectl get --raw /metrics | grep kubernetes_feature_enabled | grep -i imagevolume
  kubernetes_feature_enabled{name=&quot;ImageVolume&quot;,stage=&quot;ALPHA&quot;} 1
  </code></pre>
  <p>I tried to follow the example at <a href="https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/" rel="nofollow noreferrer">Use an Image Volume With a Pod</a> but step 1 (create the pod on your cluster fails):</p>
  <pre><code>bash-3.2$ kubectl apply -f https://k8s.io/examples/pods/image-volumes.yaml
  pod/image-volume created
  </code></pre>
  <pre><code>bash-3.2$ k get pods
  NAME           READY   STATUS         RESTARTS   AGE
  image-volume   0/1     ErrImagePull   0          7s
  </code></pre>
  <pre><code>bash-3.2$ k describe pods image-volume
  </code></pre>
  <p>results in this error: <strong>Failed to pull image &quot;quay.io/crio/artifact:v1&quot;: invalid rootfs in image configuration</strong></p>
  <p>I changed spec.volumes.image.reference to just use <code>debian</code> and then</p>
  <pre><code>bash-3.2$ k describe pods image-volume
  </code></pre>
  <p>results in <strong>Successfully pulled image &quot;debian&quot; in 607ms (607ms including waiting). Image size: 138845227 bytes.</strong> (yay!!)</p>
  <p>but also <strong>Error: Error response from daemon: invalid volume specification: ':/volume'</strong></p>
  <p>I've tried with my own images and I always get the error <strong>invalid volume specification</strong></p>
  <p>I also tried to follow this Medium article - <a href="https://medium.com/@senthilrch/kubernetes-image-volumes-a-deep-dive-6280c7a47a15" rel="nofollow noreferrer">Kubernetes Image Volumes: A deep dive</a>, but this seems to be doing things incorrectly since <code>spec.volumes.imageVolume</code> is wrong:</p>
  <pre><code>Pod in version &quot;v1&quot; cannot be handled as a Pod: strict decoding error: unknown field &quot;spec.volumes[0].imageVolume&quot;
  </code></pre>
  <p>I understand that <code>ImageVolume</code> 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?</p>
  <p>Thanks!</p>
  
Tags: <kubernetes><kubernetes-volume>
Title: Has anyone gotten Kubernetes ImageVolume working, preferably in Minikube?
UserDisplayName: Abhishek Goel
ThreadText: # Has anyone gotten Kubernetes ImageVolume working, preferably in Minikube?
  
  (Asked by: username_0 on 2024-10-25)
  
  I'm trying to [Use an Image Volume With a Pod](https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/), 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](https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/) 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](https://medium.com/@senthilrch/kubernetes-image-volumes-a-deep-dive-6280c7a47a15), 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!
  
  **Tags:** kubernetes, kubernetes-volume
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-10-25. Score: 0 | Accepted answer
  
  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>
  
  
  ---
  
  