<p>I am trying to run a docker container registry in Minikube for testing a CSI driver that I am writing. </p>

<p>I am running minikube on mac and am trying to use the following minikube start command: <code>minikube start --vm-driver=hyperkit --disk-size=40g</code>. I have tried with both kubeadm and localkube bootstrappers and with the virtualbox vm-driver.</p>

<p>This is the resource definition I am using for the registry pod deployment. </p>

<pre><code>---
apiVersion: v1
kind: Pod
metadata:
  name: registry
  labels:
    app: registry
  namespace: docker-registry
spec:
  containers:
  - name: registry
    image: registry:2
    imagePullPolicy: Always
    ports:
      - containerPort: 5000
    volumeMounts:
      - mountPath: /var/lib/registry
        name: registry-data
  volumes:
  - hostPath:
      path: /var/lib/kubelet/plugins/csi-registry
      type: DirectoryOrCreate
    name: registry-data
</code></pre>

<p>I attempt to create it using <code>kubectl apply -f registry-setup.yaml</code>. Before running this my minikube cluster reports itself as ready and with all the normal minikube containers running.</p>

<p>However, this fails to run and upon running <code>kubectl describe pod</code>, I see the following message:</p>

<pre><code>    Name:         registry
    Namespace:    docker-registry
    Node:         minikube/192.168.64.43
    Start Time:   Wed, 08 Aug 2018 12:24:27 -0700
    Labels:       app=registry
    Annotations:  kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"labels":{"app":"registry"},"name":"registry","namespace":"docker-registry"},"spec":{"cont...
    Status:       Running
    IP:           172.17.0.2
    Containers:
    registry:
        Container ID:   docker://42e5193ac563c2b2e2a2b381c91350d30f7e7c5009a30a5977d33b403a374e7f
        Image:          registry:2
    ...
    TRUNCATED FOR SPACE
    ...
    Events:
    Type    Reason                 Age   From               Message
    ----    ------                 ----  ----               -------
    Normal  Scheduled              1m    default-scheduler  Successfully assigned registry to minikube
    Normal  SuccessfulMountVolume  1m    kubelet, minikube  MountVolume.SetUp succeeded for volume "registry-data"
    Normal  SuccessfulMountVolume  1m    kubelet, minikube  MountVolume.SetUp succeeded for volume "default-token-kq5mq"
    Normal  Pulling                1m    kubelet, minikube  pulling image "registry:2"
    Normal  Pulled                 1m    kubelet, minikube  Successfully pulled image "registry:2"
    Normal  Created                1m    kubelet, minikube  Created container
    Normal  Started                1m    kubelet, minikube  Started container
    ...
    TRUNCATED
    ...
    Name:         storage-provisioner
    Namespace:    kube-system
    Node:         minikube/192.168.64.43
    Start Time:   Wed, 08 Aug 2018 12:24:38 -0700
    Labels:       addonmanager.kubernetes.io/mode=Reconcile
                integration-test=storage-provisioner
    Annotations:  kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"labels":{"addonmanager.kubernetes.io/mode":"Reconcile","integration-test":"storage-provis...
    Status:       Pending
    IP:           192.168.64.43
    Containers:
    storage-provisioner:
        Container ID:  
        Image:         gcr.io/k8s-minikube/storage-provisioner:v1.8.1
        Image ID:      
        Port:          &lt;none&gt;
        Host Port:     &lt;none&gt;
        Command:
        /storage-provisioner
        State:          Waiting
        Reason:       ErrImagePull
        Ready:          False
        Restart Count:  0
        Environment:    &lt;none&gt;
        Mounts:
        /tmp from tmp (rw)
        /var/run/secrets/kubernetes.io/serviceaccount from storage-provisioner-token-sb5hz (ro)
    Conditions:
    Type           Status
    Initialized    True 
    Ready          False 
    PodScheduled   True 
    Volumes:
    tmp:
        Type:          HostPath (bare host directory volume)
        Path:          /tmp
        HostPathType:  Directory
    storage-provisioner-token-sb5hz:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  storage-provisioner-token-sb5hz
        Optional:    false
    QoS Class:       BestEffort
    Node-Selectors:  &lt;none&gt;
    Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                    node.kubernetes.io/unreachable:NoExecute for 300s
    Events:
    Type     Reason                 Age               From               Message
    ----     ------                 ----              ----               -------
    Normal   Scheduled              1m                default-scheduler  Successfully assigned storage-provisioner to minikube
    Normal   SuccessfulMountVolume  1m                kubelet, minikube  MountVolume.SetUp succeeded for volume "tmp"
    Normal   SuccessfulMountVolume  1m                kubelet, minikube  MountVolume.SetUp succeeded for volume "storage-provisioner-token-sb5hz"
    Normal   Pulling                23s (x3 over 1m)  kubelet, minikube  pulling image "gcr.io/k8s-minikube/storage-provisioner:v1.8.1"
    Warning  Failed                 21s (x3 over 1m)  kubelet, minikube  Failed to pull image "gcr.io/k8s-minikube/storage-provisioner:v1.8.1": rpc error: code = Unknown desc = failed to register layer: Error processing tar file(exit status 1): write /storage-provisioner: no space left on device
    Warning  Failed                 21s (x3 over 1m)  kubelet, minikube  Error: ErrImagePull
    Normal   BackOff                7s (x3 over 1m)   kubelet, minikube  Back-off pulling image "gcr.io/k8s-minikube/storage-provisioner:v1.8.1"
    Warning  Failed                 7s (x3 over 1m)   kubelet, minikube  Error: ImagePullBackOff
    ------------------------------------------------------------
    ...
</code></pre>

<p>So while the registry container starts up correctly, a few of the other minikube services (including dns, http ingress service, etc) begin to fail with reasons such as the following: <code>write /storage-provisioner: no space left on device</code>. Despite allocating a 40GB disk-size to minikube, it seems as though minikube is trying to write to <code>rootfs</code> or <code>devtempfs</code> (depending on the vm-driver) which has only 1GB of space.</p>

<pre><code>$ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          919M  713M  206M  78% /
devtmpfs        919M     0  919M   0% /dev
tmpfs           996M     0  996M   0% /dev/shm
tmpfs           996M  8.9M  987M   1% /run
tmpfs           996M     0  996M   0% /sys/fs/cgroup
tmpfs           996M  8.0K  996M   1% /tmp
/dev/sda1        34G  1.3G   30G   4% /mnt/sda1
</code></pre>

<p>Is there a way to make minikube actually use the 34GB of space that was allocated to /mnt/sda1 instead of rootfs when pulling images and creating containers?</p>

<p>Thanks in advance for any help!</p>

sean.dooher
<p>You need to configure your Minikube virtual machine for using <code>/dev/sda1</code> instead of <code>/</code> for Docker. To log in to it, use <code>minikube ssh</code> command.</p>

<p>Than you have two options:</p>

<ol>
<li><p>Mount <code>/dev/sda1</code> to <code>var/lib/docker</code>, but don't forget to copy the content from original <code>var/lib/docker</code> to <code>/mnt/sda1</code> before that.</p></li>
<li><p>Reconfigure Docker for using <code>/mnt/sda1</code> instead of <code>var/lib/docker</code> for storing images. Look through this <a href="https://stackoverflow.com/questions/24309526/how-to-change-the-docker-image-installation-directory">link</a> for more information about it.</p></li>
</ol>
