Kubernetes On Windows
Early in August 2016 Microsoft released the Windows 10 Anniversary Update. There were a number of changes, but the one that got me to actually take the time to install the update was "Bash on Ubuntu on Windows". This feature would install Ubuntu Linux without the kernel. It would run linux in user-mode. Linux would run the commands while Windows does all the work/processing.
For an upcoming project I needed to get Kubernetes running. Being as Kubernetes is not able to be run in Windows the normally accepted way to procees is to create a virtual Linux box and run it from there. I wanted to see if Kubernetes would run in Bash on Ubuntu on Windows.
This is how I got it to work:
Install the Windows 10 Anniversary Update
Install Bash on Ubuntu on Windows
I followed these instructions but will also outline them here.
- Turn on Developer Mode
- Open Settings -> Update and Security -> For developers
- Select the Developer Mode radio button
- Add the Linux Subsystem
- From Start, search for "Turn Windows features on or off" (type 'turn')
- Select Windows Subsystem for Linux (beta)
- Click OK
- Wait for the install to finish
- Enable the Linux subsystem feature
- Open a PowerShell prompt as administrator and run:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- Restart if needed
- Run Bash on Windows. This will install all the Ubuntu files
- Open a command prompt
yto accept the license and install
- You will be asked about a username and password. You can use any username and password. They have no relationship to Windows users.
Install Google SDK
Now that we have Bash running installing the Google SDK is really easy. Documented here.
Run the following commands from Bash:
- Run this to install the SDK:
curl https://sdk.cloud.google.com | bash
- Restart your shell:
exec -l $SHELL
- Initialize the gcloud environment:
Once the SDK is installed we can finally install Kubernetes.
gcloud components install kubectl
You can now to run
gcloud from Bash! Woot!
My setup is that I will run
kubectl from Bash, and then any
docker commands from Windows PowerShell. Which will allow me to control my GCP projects without needing another virtual machine.