Building kubernetes on Windows 10
Cool find of the day - thanks to @brendandburns.
You can build kubernetes from scratch in bash on Windows 10, provided you:
- Install docker and make it accessible from bash on Windows 10
- build from a folder backed by an lxfs volume, i.e. not the c drive mounted as drvfs.
If you try from your User directory, e.g. C:\Users\joe\code\kubernetes, the build will fail because WSL cannot create folders with a ':' in the path during the build process.
/mnt/c/Users/cschittk/repos/kubernetes$ ./hack/dev-push-hyperkube.sh
+++ [0530 15:13:25] Verifying Prerequisites....
mkdir: cannot create directory ‘/mnt/c/Users/cschittk/repos/kubernetes/_output/images/kube-build:build-731ef7ee24-5-v1.8.3-1’: Invalid argument
!!! [0530 15:13:39] Call tree:
!!! [0530 15:13:39] 1: ./hack/dev-push-hyperkube.sh:44 kube::build::build_image(...)
!!! Error in ./hack/../build/common.sh:411
Error in ./hack/../build/common.sh:411. '((i<3-1))' exited with status 1
Call stack:
1: ./hack/../build/common.sh:411 kube::build::build_image(...)
2: ./hack/dev-push-hyperkube.sh:44 main(...)
Exiting with status 1
That's because /mnt/c is a FAT or NTFS backed file system mounted as drivefs, which has a few limitations inherent to the underlying file system.
However, the bash's drive is not enitrely drvfs, even though it lives on the same underlying file system. When you take a closer look, you'll see that / and other folders are mounted using the bash's VolFS, which is much closer to the Linux file system:
$ mount
rootfs on / type lxfs (rw,noatime)
data on /data type lxfs (rw,noatime)
C: on /mnt/c type drvfs (rw,noatime)
root on /root type lxfs (rw,noatime)
home on /home type lxfs (rw,noatime)
Even though rootfs lives on your NTFS drive at %LocalAppData%\lxss\rootfs, WSL can create those paths:
and the kubernetes build will succeed in bash on Windows 10