Harness and Windows - Possibilities are Endless

A few weeks ago my MacBook Pro suffered from the dreaded butterfly keyboard problem and I had to make a trip to the Apple Store to get a new keyboard put in. Though this took a few days, I had to end up using my gaming laptop for some work tasks. I have been developing on a Mac since 2011 and this was my first time since 2011 using a Windows Machine for development work. Where did my beloved Terminal go!?

There has been a lot of advancements in the Windows Ecosystem over the past decade and the line between Windows and Linux is blurring, e.g WSL.

To get started on having a Harness Delegate installed on your Windows Machine, here are a few moving parts to get you up and running.

  1. Powershell
  2. Chocolaty [Package Manager]
  3. Hyper-V
  4. Docker Desktop
  5. Minikube
  6. Deploy Harness Delegate

Powershell

So the first thing I had to relearn that there is a difference between Powershell CMD and just plain old CMD. This embarrassingly took me like 45 minutes to figure out. The commands from here on out run on Powershell CMD.

Chocolatey

Chocolatley is a package manager for Windows, similar to Homebrew for your Mac.

Getting Chocolatley installed is straightforward. Run the commands in the installation documentation. You will need to run in administrative mode.

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Hyper-V

Hyper-V is used to create virtual machines on your Windows machine. Can follow the Microsoft documentation for installing via Powershell CMD.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Docker Desktop Windows

There are a few ways to install Docker Desktop for Windows. Since you just grabbed Chocolatey, let it do the hard work.

choco install docker-desktop

Minikube on Windows

The great equalizer, Minikube, can be installed on Windows. WIth the pre-reqs out of the way [HyperV and Docker], again can let Chocolatey do the work.

choco install minikube

Fire Up Minikube

A little different than your Mac, will need to set a few items on Minikube to use HyperV and allocate some more memory.

minikube config set driver hyperv
minikube config set memory 8128 

Make sure you are still in the administrative powrshell.

minikube start

Install the Harness Delegate

If you have not already, sign up for an Harness Account. Then can head to app.harness.io.

Once signed in, head to Setup → Harness Delegates → Install Delegates → Kubernetes

Download the Kubernetes Delegate YAMLs. This comes as a tar.gz, so you will need a program like 7-zip to expand. Make sure in 7-zip to select “tar” and “gz” as files associated with 7-zip.

Expand the archive and CD into the folder.

Run the instructions in the README.txt which has the apply instructions.

Potentially you will need to tune down the Delegate Resource Limit depending on how much memory you have allocated to the cluster. Here I tuned mine down to 3 Gi.

Once tuned can apply.

kubectl apply -f harness-delegate.yaml

Wait a few moments, and you will be all set to go!

Troubleshooting

Hyper-V and Docker Desktop [Docker Process] need to be running. So if you run through this example and want to restart, make sure to ensure those items are in place.

Some KubeCTL commands.

kubectl get pods -n harness-delegate
kubectl describe pods -n harness-delegate <pod-name>

Clean Up

Stop and delete Minikube.

minikube stop

For now if using Hyper-V, will need to delete the VM from Hyper-V itself.

Then you can run the Minikube delete.

minikube delete

Thanks for checking it out!

-Ravi