Kubernetes: From Fear to Functions in 20 Minutes

Kubernetes. I tell ya…it’s all the rage.

I’m a huge fan of OpenFaaS and have always run it using Docker Swarm. With people claiming Kubernetes (K8s) has “won,” I decided to switch my local setup to run OpenFaaS there.

I’ve been super nervous to try K8s — mostly because of the unknown steps I’d have to take and the many new terms and ideas surrounding it.

I’ve got a use-case for you Andrew

TL;DR: You can view all of my steps below in a GitHub gist here.

I decided to start with the OpenFaaS documentation to see what it had to say. If you follow this guide and something doesn’t seem quite right, check the docs first.

First off, I needed a cluster.

A what? A K8s cluster is essentially one “cluster master” with multiple worker machines called nodes; the Kubernetes objects that represent your containerized applications all run on top of a cluster (info from here).

I heard recently that you can run Kubernetes with Docker for Desktop if you run the Edge version. I like to live dangerously (not really) so I decided to switch. You can download it from here (scroll down some).

After that was downloaded and installed, I was ready for step two.

Here are the fancy Edge Kubernetes settings in Docker. Woohoo!

Step two of the OpenFaaS documentation says to “Pick helm or YAML files for deployment”. I wanted to try Helm so I went with that. Clicking the link in the OpenFaaS documentation took me here.

I installed Helm on my MacBook with this:

$ brew install kubernetes-helm

Then I created RBAC permissions for Tiller (Tiller runs inside of your Kubernetes cluster and manages releases or installations of your charts):

$ kubectl -n kube-system create sa tiller \
&& kubectl create clusterrolebinding tiller \
--clusterrole cluster-admin \

And finally I installed the server-side Tiller component:

$ helm init --skip-refresh --upgrade --service-account tiller

Now it was time to deploy OpenFaaS via Helm!

After navigating to the OpenFaaS Helm README, I needed to create two namespaces: “one for the OpenFaaS core services and one for the functions”:

$ kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml

You can view the contents of that file to see what it’s doing. Some quick Googling will help you understand the format and contents.

I added the OpenFaaS Helm chart:

$ helm repo add openfaas https://openfaas.github.io/faas-netes/

And deployed OpenFaaS from the helm chart repo:

$ helm upgrade openfaas --install openfaas/openfaas \
--namespace openfaas \
--set functionNamespace=openfaas-fn

Well, that was fun! But now what?

Having been a long-time OpenFaaS user, I knew that I needed to navigate to http://localhost:8080/ui/ to see the beautiful web-based front-end, but that didn’t work. The OpenFaaS documentation says that the “API Gateway/UI” is located on port 31112 for Kubernetes. I typed http://localhost:31112/ui/ into my browser and voila — the OpenFaaS UI I’m used to! Feel free to deploy some sample functions (I’m fond of the OpenFaaS Text-to-Speech function myself ;)).

Wrapping up

The OpenFaaS community is full of awesome people doing awesome things!

Support the community and donate via Patreon. You can also star or fork the projects here: https://github.com/openfaas.

Be sure to follow @openfaas on Twitter too!

Here are some other links with great information: