Skip to content

Tips for running in Kubernetes on Windows

Kevin Ring edited this page Nov 17, 2016 · 2 revisions

If you're using Hyper-V (which you probably are if you previously installed Docker for Windows), you need to specify it when starting minikube:

minikube start --vm-driver hyperv

If Kubernetes is unusable even after it started successfully, the problem may be that your Hyper-V VM doesn't have network access. Launch the Hyper-V manager, click Virtual Switch Manager, click DockerNAT and switch to "External Network". There's probably a better way to do this (i.e. set up working NAT) but this will at least work. Then, restart the VM:

minikube stop
minikube start

In order to be able to share files between the host (Windows) and the containers, you need to mount the host volume in the minikube VM. First, share your C drive using Windows Explorer. Then, SSH into the VM and mount the share:

minikube ssh
sudo mount -t cifs -o "user=yourusername,domain=yourdomain,password=yourpassword" //192.168.1.5/c /c

Replace 192.168.1.5 with a host IP address that works from the VM (test with a ping). The docs claim that if you leave off the password you'll be prompted for it, but it didn't work for me. So be careful about leaving your password in the history.

Then, in local.yml, use /c/whatever as the source path for volumes. e.g.:

      volumes:
      - name: regions
        hostPath:
          path: /c/github/magda-metadata/regions
      - hostPath:
          path: /c/github/magda-metadata
        name: src
      - hostPath:
          path: /c/Users/rin035/.ivy2/
        name: ivy-cache

Auto-recompile-on-changes stops working after suspend/resume?

This is caused by clock in the minikube VM getting out of sync with host's clock. Hyper-V has a feature called "Time synchronization" but it works by slowly drifting the VM clock toward the host's clock. So after the host is suspended for a few hours, it can take a really long time before the VM's clock matches again so that timestamp-based build triggering actually works.

So, to fix this after a resume, toggle the time sync feature off and back on again. Open the Hyper-V Manager, open the Settings for minikube, click Integration Services under Management, uncheck the Time Sychronization box, click Apply, re-check the Time Sychronization box, and hit Apply again. You should see your build trigger immediately if you've already made changes.