Deploying OpenFaaS on Linux with Minikube

Avishka Shamendra
3 min readOct 18, 2022

With this guide you will be able to install OpenFaaS on Linux and get it up and running on minikube

Docker Engine Installation

We need to install Docker Engine first.

  1. If you have Docker Desktop installed in your Linux machine uninstall Docker Desktop. Minikube will not work with Docker Desktop on Linux. To uninstall run following commands
$ sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli
$ sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
$ sudo rm -rf /var/lib/docker /etc/docker
$ sudo rm /etc/apparmor.d/docker
$ sudo groupdel docker
$ sudo rm -rf /var/run/docker.sock
$ sudo rm -rf /usr/local/bin/docker-compose
$ sudo rm -rf /etc/docker
$ sudo rm -rf ~/.docker

2. Now let’s install Docker Engine

$ sudo apt-get update
$ sudo apt install docker.io
$ sudo snap install docker

3. Check the installation with

$ docker --version

4. Let us pull an image from docker hub and see whether everything works fine

$ sudo docker run hello-world
$ sudo docker ps -a
$ sudo docker ps

5. So, up to now we needed to use sudo with docker commands. Let’s configure to run docker with non root users.

$ sudo groupadd docker
$ sudo usermod -aG docker $USER
$ newgrp docker
Now you should be able to run docker command without sudo
$ docker run hello-world

Arkade Installation

arkade is a tool to install and deploy apps and services to Kubernetes. One can think of this as a package manager like npm.

To install arkaderun:

$ curl -sLS https://dl.get-arkade.dev | sudo sh

Follow the instructions given in the terminal to complete the installation.

Minikube Installation

  1. Let’s install minikube,kubectl with arkade
$ arkade get minikubeFollow the instructions given in the terminal to complete the installation.$ arkade get kubectlFollow the instructions given in the terminal to complete the installation.

2. Now let us start our minikube cluster. This will take sometime

$ minikube start

3. If it fails to start, see the minikube drivers page for help. If all goes well, our cluster is ready and we can use kubectl to interact with it.

$ kubectl get pods -A

OpenFaaS Installation

  1. Let’s install openfaas now with arkade
$ arkade install openfaasFollow the instructions given in the terminal to complete the installation.

2. To verify that OpenFaaS has started, use the following command

$ kubectl -n openfaas get deployments -l "release=openfaas, app=openfaas"

3. Next let’s install faas-cli with arkade

$ arkade get faas-cli
Follow the instructions given in the terminal to complete the installation.

4. To forward the FaaS gateway to your machine

$ kubectl rollout status -n openfaas deploy/gateway
$ kubectl port-forward -n openfaas svc/gateway 8080:8080 &

5. Let’s now setup the basic auth so you can log into your gateway

$ PASSWORD=$(kubectl get secret -n openfaas basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode; echo)
$ echo -n $PASSWORD | faas-cli login --username admin --password-stdin

6. The output of the following command is your gateway password. Save it in a secure place

$ echo $PASSWORD

7. Let’s deploy a dummy function and see if every thing works fine

$ faas-cli store deploy figlet
$ faas-cli list

You should see that “figlet” is now deployed.

Also, now you should be able to go to the OpenFaaS portal from your browser. (http://localhost:8080/ui/).

Username : admin | Password : {saved password}

That’s it. In the next article let’s see how we can write and deploy functions.

Make sure you clap if you liked it and feel free to leave a comment.

--

--

Avishka Shamendra

Computer Science and Engineering Undergraduate at University of Moratuwa, Sri Lanka