Providing a consistent Developer Experience on Windows: Kubernetes + Tilt

Peter McInerney
3 min readMay 4, 2019

--

Earlier this year I had a question asked of me to help provide a solution to help align process and tooling across their teams and platforms. The core teams were building a brand new platform with Cloud Native approach and with that the process to release small and release often.

However, for a segment of their assets they had a sole developer who they wanted to help bring into the same process and tooling as the rest of the development group.

I had introduced the core development team to tilt which was something I’d been rolling out at my former employer to bring a production like environment to the local developers with a vision of failing fast and a tight feedback loop.

The core team used OSX and leveraged a workflow of Gerrit, Jenkins and with their applications finally being deployed in Kubernetes (GKE). This sole developer was managing their code in git but did not have CI feedback or infrastructure as code applied to their applications. This sole developer also used Windows for their development environment.

The challenge: How do we give a consistent and cohesive experience to everyone in the development organization?

Luckily, this developer was on Windows 10 Pro, this meant we could run Docker Desktop (as this requires Hyper-V). We enabled the Linux Sub-System and with a few minutes of trickery provided the same flow and tooling as the remainder of the team.

Below we will invoke the tilt demo running on Windows

Enable Subsystem for Linux (WSL)

Open Powershell as administrator

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

When prompted enter Y to restart Windows.

Install Ubuntu

Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing Ubuntu.appx

When prompted — enter a username and password for this Ubuntu instance

Generate a ssh-key for this new machine ( You may need to enable QuickEdit to be able to copy/paste, Right click on the top bar > Properties > Check QuickEdit)

ssh-keygen cat ~/.ssh/id_rsa.pub

Install Linuxbrew
Homebrew is an amazing toolset for managing your OSX hardware, and the team has instructions that leverage this. As such, I opted to use the newly provided Linuxbrew to ensure the instructions provided to run applications would work cross platform.

sudo apt-get -y install build-essential curl file git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)" echo "eval \$($(brew --prefix)/bin/brew shellenv)" >> ~/.profile
source ~/.profile

Install Docker Desktop (Windows)
Download and install the Docker Installer

Now switch to the Ubuntu Terminal

sudo apt-get update sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update sudo apt-get -y install docker-ce echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bash_profile
source ~/.bash_profile

Kubernetes CLI

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
ln -s /mnt/c/Users/USERNAME/.kube/ ~/
kubectl config use-context docker-for-desktop

Install Tilt (On Ubuntu)

curl -sL https://github.com/windmilleng/tilt/releases/download/v0.8.1/tilt.0.8.1.linux.x86_64.tar.gz | tar -xz tilt
sudo mv tilt /usr/local/bin/tilt

Because Tilt is an amazingly neat project, and analytics aren’t enabled by default I strongly urge you to enable them and help out the development team.

tilt analytics opt in

From here, the Windows user was able to run the tilt command from their Ubuntu shell, consuming Kubernetes running on windows natively. Whilst editing code in Visual Studio - and when files saved/edited they process via tilt would automatically rebuild and restart the application.

tilt demo

Whilst tilt is running, you can now take advantage of their new UI for preview/logs and errors available at http://localhost:10350/

Watch the video below for a demonstration of tilt running on windows leveraging the windows linux subsystem (WSL).

Originally published at https://misconfigured.net.

--

--

Peter McInerney

Technology Leader — Engineering/DevOps/SRE/Technical Operations