Minikube Setup with Harness!

Background

Harness documentation suggests to leverage a free tier Google Cloud Platform instance and spin up a Google Kubernetes Engine instance. Can run through the Quick Start with minikube.

First Steps

To get started is pretty easy. Can run through a few pre-reqs which would not be too bad.

  1. Sign up for a free Harness.io account. I just used my Google Credentials.

  2. I am using a Mac, leveraging HomeBrew for the package manager makes MiniKube install pretty seamless.

  3. Grab the latest version of VirtualBox, can try out your newly installed HomeBrew!

  4. β†’ brew cask install virtualbox

  5. Make sure to grab one of the 5.2.x versions or 6.x versions. Can also go download from VirtualBox themselves.

1. https://download.virtualbox.org/virtualbox/5.2.28/VirtualBox-5.2.28-130011-OSX.dmg

Second Steps

Once HomeBrew and VirtualBox are set up, can get to installing minikube. Some of these steps take into account having to run this again. If this is your first install, can skip those.

  1. Install minikube

  2. β†’ brew cask install minikube

  3. Install kubectl which is the Kubernetes CLI. Important to have the same version of kubectl and minikube kubernetes.

  4. Remove old installs if you have β†’ rm β€˜/usr/local/bin/kubectl’

  5. Install new β†’ brew install kubernetes-cli

  6. If coming from a previous version re-link β†’ brew link kubernetes-cli

  7. Validate version β†’ kubectl version

1. ![|541x164](//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/business7/uploads/harness/original/1X/3c656aa04696897b7b6e0f299a159ca4463f9e11.png)
  1. Can start minikube now. Minikube will automatically create a KubeCTL context called β€œminikube” to start. The Harness Delegate and Sample App takes about 4g of memory.

  2. Tune the MiniKube install to have a VM with 8g of mem: β†’ minikube config set memory 8128

  3. Start minikube: β†’ minikube start

1. ![|545x168](//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/business7/uploads/harness/original/1X/f2b17bc27084f0428caf310dcf393e02f6b78833.png)
  1. If leveraging kubectl for other kubernetes clusters, set the context again β†’ kubectl config use-context minikube

  2. Fireup the kubernetes web dashboard from minikube β†’ minikube dashboard

Harness K8s Steps

The Harness documentation does a pretty good job in the wiring. Basically after setting up a free account, you will be getting your first delegate which will interface with your minikube cluster.

  1. Can follow the Google Cloud Platform steps by skipping to the GKE cluster set-up steps and going straight to delegate steps since you are using minikube.

  2. Built-in App Tour Guide for Freemium Accounts - Harness.io Docs

  3. Run through the naming and downloading of the delegate.

  4. Download the delegate tar.gz of the delegate then change the resource limit in the harness delegate container spec which is in the harness-delegate.yaml. This will boot fine.

  5. memory: β€œ4Gi”

1. ![|527x239](//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/business7/uploads/harness/original/1X/b7ca04b87d9bf27e90e1de63ec6793f5cc75537f.png)
  1. Use kubectl to apply the delegate β†’ kubectl apply -f harness-delegate.yaml

  2. Should be cooking with gas! Can get status β†’ kubectl get pods -n harness-delegate

  3. Having some trouble? (no shame K8s is funny!)

1. Make sure the same version of kubectl and K8s inside minikube are running. Can assume latest and latest. At time of this document this is 1.14.1.
2. Can describe the pod to see status -> kubectl describe pods -n harness-delegate
3. Can delete the pod and try again -> kubectl delete pods -n harness-delegate

Your First Deploy!

Harness makes this very easy. Your free account has a Harness Manager [e.g the controller] hosted on Harness’s SaaS. This will communicate with your minikube cluster!

  1. Harness documentation goes through pretty well on deploying the sample app. The pre-reqs for the Docker Registry was already set up for me in my free account.

  2. Built-in App Tour Guide for Freemium Accounts - Harness.io Docs

  3. Deploy and prosper!

  4. Phew kept the memory in check on my 16g MBP!

1. ![|384x102](//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/business7/uploads/harness/original/1X/abdc5bac379ce639d9b7142e974079a1ab67d2ae.png)
  1. The sample app has a workflow approval which is pretty intuitive.
1. ![|477x186](//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/business7/uploads/harness/original/1X/04a43b13c91b3dbb1e3000a825218f1f581cae8a.png)
  1. Can check out the K8’s cluster to see some new stuff on there.

  2. Harness Delegate:

1. ![|515x318](//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/business7/uploads/harness/original/1X/8945da140de70fb2a36aff9230b321d09a2448fe.png)
  1. Harness Sample App:
1. ![|536x290](//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/business7/uploads/harness/original/1X/794297339c4a4e96844652f79debaf002c8fdeef.png)
  1. Sit back and watch your hard work.

Cleanup Steps

Like a good citizen, clean up after yourself. Can do this pretty quickly.

  1. Stop minikube β†’ minikube stop

  2. Can also delete your VM β†’ minikube delete

  3. Can make tweaks directly on Virtual Box by firing up VB β†’ VirtualBox

Update for June 2020:

Brew is native, not cask:

brew install minikube
brew link minikube

Or to update:

brew upgrade minikube
brew link minikube

Great doc! This helped me give Harness a try with Minikube.

In case you are running into insufficient memory issue starting the Delegate pod, change the memory allocated to the Minikube (VM). You can do that either through VirtualBox settings or passing the --memory parameter when you do minikube start. If you do this, PLEASE DO a DELETE and restart as follows:

minikube stop //if still running
minikube delete
minikube start --memory 4096 //you can set this to higher if you kept, in the Yaml, Harness Delegate memory at 4G. I used 2G and worked fine

1 Like

Some updates since the Docker Driver move in Kubernetes and some hygiene keeping
Minikube up-to-date.

Update:

brew upgrade minikube
brew link minikube

Docker:

minikube config set driver docker
minikube start --driver=docker

Or pick your choice:

minikube config set driver virtualbox
minikube start --driver=virtualbox

If you continue to have issues, can force delete your Minkube profile and restart:

minikube delete --all --purge

Also if you have not used Brew in a long time, as of Dec 2020 you need an Unshallow Copy
of Cask, Brew, etc:

If you just upgraded to Big Sur like myself

brew install docker-machine-driver-hyperkit
minikube config set driver hyperkit