Technologies faas in kubernetes

July 15, 2020


Stack

For this study I will use multipass to mount the linux virtual machines and microk8s to create the kubernetes clusters, in another entry I will document how to mount the clusters in this stack.

Test

  • Knative
  • OpenFaas
  • OpenWhisk

Install

Knative

  • Prerequisites

Microk8s whit istio.

https://knative.dev/docs/install/any-kubernetes-cluster/

  • Installing the Serving component
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.15.0/serving-crds.yaml
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.15.0/serving-core.yaml
kubectl apply --filename https://github.com/knative/net-istio/releases/download/v0.15.0/release.yaml
  • Monitor the Knative components until all of the components show a STATUS of Running or Completed:
kubectl get pods --namespace knative-serving
  • Installing the eventig component
kubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-crds.yaml
kubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-core.yaml
kubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/in-memory-channel.yaml
kubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/mt-channel-broker.yaml
  • Monitor the Knative components until all of the components show a STATUS of Running:
kubectl get pods --namespace knative-eventing
  • Installing the Observability plugin
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.16.0/monitoring-core.yaml
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.16.0/monitoring-metrics-prometheus.yaml

OpenFaas

  • Clone repository
git clone https://github.com/openfaas/faas-netes
  • Create namespaces
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
  • Generate password
# generate a random password
PASSWORD=$(head -c 12 /dev/urandom | shasum| cut -d' ' -f1)

kubectl -n openfaas create secret generic basic-auth \
--from-literal=basic-auth-user=admin \
--from-literal=basic-auth-password="$PASSWORD"
  • Deploy openfaas
cd faas-netes && \
kubectl apply -f ./yaml
  • install cli

TODO

OpenWhisk

  • Prerequisites

Look for the ip of the virtual machine

multipass list

Name                    State             IPv4             Image
knative                 Stopped           --               Ubuntu 18.04 LTS
openwhisk               Running           192.168.64.10    Ubuntu 18.04 LTS
openfaas                Stopped           --               Ubuntu 18.04 LTS

Enable helm3 in cluster

multipass shell <vm name>
microk8s enable helm3
  • Clone repository
git clone https://github.com/apache/openwhisk-deploy-kube.git
  • Customize the Deployment create mycluster.yaml
whisk:
  ingress:
    type: NodePort
    apiHostName: 192.168.64.10 #<change by ip of vm*>
    apiHostPort: 31001

nginx:
  httpsNodePort: 31001
  • Deploy With Helm
microk8s helm3 install owdev ./helm/openwhisk -n openwhisk --create-namespace -f mycluster.yaml
  • Install and Configure the wsk CLI

TODO