Skip to content

freynca/sk8s

 
 

Repository files navigation

Sk8s: a FaaS for Kubernetes

Prerequisites

  • A running 1.7 Kubernetes cluster with at least 4GB of memory. These instructions assume minikube for now.

minikube start --cpus=4 --memory=4096 --disk-size=64g

Installation

You can install the system using a Helm chart or by manually building and deploying the components.

Helm install of Sk8s FaaS

Sk8s offers a Helm Chart for deploying the FaaS and its required services to a Kubernetes Cluster. The following instructions cover how to initialize Helm and install Sk8s FaaS on the Minikube cluster.

Install Helm

Helm is comprised of 2 components: one is the client (Helm) the other is the server component (Tiller). The Helm client is run on your local machine and can be installed using the instructions found here: https://github.com/kubernetes/helm/blob/master/README.md#install

Once you have Helm client installed you can install the server component using:

helm init
Note
To verify that the Tiller pod has started execute the following command: kubectl get pod --namespace kube-system and you should see the tiller pod running.

Add the Sk8s repository to your Helm environment

Run the following commands to add the sk8s-incubator repository:

helm repo add sk8s-incubator http://sk8s-incubator.cfapps.io
helm repo update

Install Sk8s FaaS helm chart

Install the Sk8s Helm chart using the following command:

helm install --name demo sk8s-incubator/sk8s

You should see a number of resources get created in your Minikube. You can see them all using:

kubectl get all,jobs,functions,topics

Clone the repo

To work with the demos and Metrics Dashboard you need a clone of the Sk8s repo:

git clone https://github.com/markfisher/sk8s.git

Enable Metrics and Tracing Dashboards

You can enable each dashboard by setting flags for the Helm release. For the Metrics Dashboard use --set enable.metricsDashboard=true and for the Tracing Dashboard use --set enable.metricsDashboard=true.

These flags can be set when installing the chart or you can apply them during an upgrade operation. Here is an example of upgrading the release and enabling the Metrics Dashboard:

helm upgrade demo sk8s-incubator/sk8s --set enable.metricsDashboard=true

See how to use the dashboards and run some samples.

To tear it all down

helm delete demo --purge

Manual install of Sk8s FaaS

You need:

  • Git installed.

  • A Java 8 environment.

  • A working Go environment, with a clone of Eric Bottard’s customized fabric8io/kubernetes-model.

cd $(go env GOPATH)   #defaults to ~/go
git clone https://github.com/ericbottard/kubernetes-model src/github.com/fabric8io/kubernetes-model/
  • A clone of this repo.

git clone https://github.com/markfisher/sk8s.git

Build the kubernetes-model jar Enhanced with the Types for the CustomResources

./build-model

Setup the Kubernetes environment

Create Function and Topic Custom Resource Definitions:

kubectl apply -f config/types

Point your Docker environment to the Docker environment running in minikube:

eval $(minikube docker-env)

Build Sk8s FaaS

Build components and create Docker images:

./mvnw clean package
./dockerize

Deploy Kafka/Zookeeper

kubectl apply -f config/kafka

Deploy Sk8s FaaS

kubectl apply -f config

Deploy Metrics (Grafana/Prometheus) and Tracing (Zipkin) Dashboards

kubectl apply -f config/prometheus
kubectl apply -f config/grafana
kubectl apply -f config/zipkin

See how to use the dashboards and run some samples.

To tear it all down

./teardown

Try Some Samples

With the Sk8s FaaS running try some of the samples.

Using the Metrics and Tracing Dashboards

Metrics with Grafana

To access the Grafana Metrics Dashboard run the following from a terminal:

minikube service $(kubectl get svc -l component=grafana -o jsonpath='{.items[0].metadata.name}')

Once the app opens click on "Add data source" and enter the following:

Name:   sk8s
Type:   Prometheus
Url:    http://demo-sk8s-prometheus:9090    [for Helm install this must match the service
                                             name based on the name given to the release
                                             which was "demo" in our case. For a manual
                                             install use http://prometheus:9090]
Access: proxy

Once the sk8s data source is created select Dashboards - Import from the top left menu drop down. Select Upload .json file and locate the sk8s-grafana.json that is in the root directory of the cloned sk8s repo. Select sk8s for the Select a Prometheus data source option and click Import.

Tracing with Zipkin

To access the Zipkin dashboard run the following from a terminal:

minikube service $(kubectl get svc -l component=zipkin -o jsonpath='{.items[0].metadata.name}')

When the dashboard opens, click on the Find a trace link on the top bar. Then select a component from the top-left drop down menu and click the Find Traces button.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 75.6%
  • Shell 14.6%
  • Batchfile 7.3%
  • Python 1.8%
  • Other 0.7%