As you see, your Kubernetes cluster based on Minikube is started now or will be available shortly. Verify it's ready for your use:
minikube version && minikube status
First, create two namespaces, one for the OpenFaaS core services openfaas and a second for the functions openfaas-fn.
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
Then generate a Kubernetes secret for basic authentication for the gateway
kubectl -n openfaas create secret generic basic-auth --from-literal=basic-auth-user=user --from-literal=basic-auth-password=$(cat user-password.txt)
Install OpenFaaS Operator
Helm is a package manager for Kubernetes and is initialized and ready.
A common Helm chart is predefined for installing OpenFaaS. Normally, popular charts appear in the curated Helm chart repository and there are plans to move OpenFaaS there. For now, this
repo add command will allow Helm to find the OpenFaaS chart:
helm repo add openfaas https://openfaas.github.io/faas-netes/
Install the OpenFaaS operator
helm upgrade openfaas --install openfaas/openfaas --namespace openfaas --set basic_auth=true --set functionNamespace=openfaas-fn --set operator.create=true --set rbac=false
Watch the 5 deployments for OpenFaaS become Available. The Available status column turns from 0 to 1 once each deployment has initialized.
kubectl --namespace=openfaas get deployments -l "release=openfaas, app=openfaas"
Finally, install the OpenFaaS command-line interface (CLI) tool.
curl -sSL https://cli.openfaas.com | sh
Verify it is installed
At this point there is a OpenFaaS gateway providing access to both the portal and REST API to manage the functions and OpenFaaS. Most of the CLI commands from this point going forward require this gateway as a parameter. (It's an inconvenience when using the CLI, but perhaps there is a security concern why this cannot be a sticky setting.). To reduce the verbosity the gateway can be stored as an environment variable. If you were running Minikube locally, the command would be
GW=$(minikube service gateway-external --namespace openfaas --url)
But on Katacoda, because of the server virtualization the gateway is here
With the gateway access, the first action is to login
cat user-password.txt | faas-cli login --username user --password-stdin --gateway=$GW
You can also explore the OpenFaaS functions in the portal. On the right there is a tab called OpenFaaS Portal or from this link: https://[[HOST_SUBDOMAIN]]-31112-[[KATACODA_HOST]].environments.katacoda.com/
When prompted, use the same user name and password that was applied above in the secret creation (user/user). For visibility and understanding, leave this tab open for the subsequent steps.