Deploy OpenFaaS with k3sup and minikube

A couple of years ago I wrote a blog post on how to install OpenFaaS using minikube, and since then the project has grown and been updated. The tutorial is still up to date. Today I want to show you how that process has been automated and now you can enjoy a simpler way to get started.

This tutorial is for MacOS, the instructions for Linux or Windows may vary slightly, if you need any technical support feel free to join OpenFaaS slack.

Get minikube

Minikube recently had a facelift and gained emojis and reliability updates. It still requries a hypervisor like hyperkit (built into MacOS) or VirtualBox. This means that a separate Virtual Machine (VM) is run on your computer.

  • Download minikube from https://minikube.sigs.k8s.io/docs/start/

    I prefer the "direct" download which is faster than using brew.

  • Start a VM with Hyperkit

    In my experience Hyperkit is faster and lighter weight than VirtualBox, so you should try that first. If it doesn't work out, then fall-back to VirtualBox.

    Let's allocate 4GB so that we have more than enough resources:

    minikube start --vm-driver=hyperkit \
      --memory 4048mb \
      --kubernetes-version='v1.15.0'
    

    Enjoy the new emojis:

    😄  minikube v1.4.0 on Darwin 10.14.6
    🔥  Creating hyperkit VM (CPUs=2, Memory=4048MB, Disk=20000MB) ...
    🐳  Preparing Kubernetes v1.15.0 on Docker 18.09.9 ...
    🚜  Pulling images ...
    🚀  Launching Kubernetes ... 
    ⌛  Waiting for: apiserver proxy etcd
    🏄  Done! kubectl is now configured to use "minikube"
    

    At time of writing, v1.15.0 is a more suitable choice than v1.16.0 since some projects are still updating for breaking changes in the latest version of Kubernetes.

    Your Kubernetes context should be automatically set to minikube, check that with kubectl config get-contexts.

Get k3sup ('ketchup')

k3sup is a tool that can create Kubernetes clusters using k3s, but it can also install helm charts and applications to any Kubernetes cluster.

curl -SLfs https://get.k3sup.dev | sudo sh

See also: k3sup website

Install OpenFaaS

Run the following for an installation:

k3sup app install openfaas --load-balancer

The tool will use the helm chart, but will bypass the use of tiller, which is considered by some to be insecure.

Get up and running

The k3sup tool will tell you how to get your password and open the OpenFaaS UI. You're now good to go.



Pictured: OpenFaaS Portal

You can find out what other apps you can install using k3sup app install --help.

What next?

You'll need these commands:

  • minikube start - start your environment again
  • minikube delete - clean-up the cluster

What else can you try?

You may also like: Kubernetes Homelab with Raspberry Pi and k3sup