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:
This was pretty straight forward. Download the Windows 10 Upgrade tool. I found the tool initially here. The upgrade will take about 45ish minutes depending on your internet connection and computer.
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
- Run
bash
- Type
y
to 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.
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:
gcloud init
Once the SDK is installed we can finally install Kubernetes.
gcloud components install kubectl
Example Hello World Walkthrough
You can now to run kubectl
, gcloud
from Bash! Woot!
My setup is that I will run kubectl
from Bash, and then any gcloud
and docker
commands from Windows PowerShell. Which will allow me to control my GCP projects without needing another virtual machine.
Works perfect.Thanks for the share