Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

evry-bergen/kubeless-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubeless Workshop

Serverless Kubernetes Workshop with Kubeless, NATS, and Minio. In this workshop you will learn how to:

  • Set up a Kubeless
  • Creating functions using the kubeless CLI
  • Creating triggers for invoking functions

0. Prerequsite

Tool Version
Virtualbox v5.2.18
Minikube v0.29.0
kubectl v1.11.3
Helm v2.11.0
Kubeless v1.0.0-alpha.8

1. Installing Dependencies

1.1. Setting up Minikube

Download the Minikube utility:

Architecture Download
Mac https://github.com/kubernetes/minikube/releases/download/v0.29.0/minikube-darwin-amd64
Linux https://github.com/kubernetes/minikube/releases/download/v0.29.0/minikube-linux-amd64
Windows https://github.com/kubernetes/minikube/releases/download/v0.29.0/minikube-windows-amd64
$ minikube start --memory 4096 --disk-size 40g --kubernetes-version v1.11.3 -v 4
$ minikube addons enable ingress

Verify Minikube

Verify the setup by running the following commands:

$ minikube status
$ kubectl version
$ kubectl cluster-info
$ kubectl get nodes

Set up the required ingress hostnames for this workshop:

$ make add-etc-hosts
Manual /etc/hosts install
$ export MINIKUBE_IP=$(minikube ip)
$ sudo sh -c "echo \"\n\" >> /etc/hosts"
$ sudo sh -c "echo \"$MINIKUBE_IP  minio.minikube\" >> /etc/hosts"
$ sudo sh -c "echo \"$MINIKUBE_IP  nats.minikube\" >> /etc/hosts"
$ sudo sh -c "echo \"$MINIKUBE_IP  kubeless.minikube\" >> /etc/hosts"
$ sudo sh -c "echo \"$MINIKUBE_IP  promethues.minikube\" >> /etc/hosts"
$ sudo sh -c "echo \"$MINIKUBE_IP  grafana.minikube\" >> /etc/hosts"
$ sudo sh -c "echo \"$MINIKUBE_IP  function-python.minikube\" >> /etc/hosts"
$ sudo sh -c "echo \"$MINIKUBE_IP  function-node.minikube\" >> /etc/hosts"

1.2. Install up Helm

Download the Helm client CLI:

Architecture Download
Mac https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-darwin-amd64.tar.gz
Linux https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-linux-amd64.tar.gz
Windows https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-windows-amd64.zip

Install the Helm server component:

$ helm init --upgrade

Verify that Helm is set up correctly:

$ helm version

1.3. Install Kubeless

Download the Kubeless client CLI:

Architecture Download
Mac https://github.com/kubeless/kubeless/releases/download/v1.0.0-alpha.8/kubeless_darwin-amd64.zip
Linux https://github.com/kubeless/kubeless/releases/download/v1.0.0-alpha.8/kubeless_linux-amd64.zip
Windows https://github.com/kubeless/kubeless/releases/download/v1.0.0-alpha.8/kubeless_windows-amd64.zip

Install the Kubeless control pane:

$ make install-kubeless
Manual install with Helm
$ helm upgrade kubeless ./charts/kubeless \
  --namespace kubeless \
  --values config/kubeless.yaml \
  --install \
  --wait \
  --timeout 600 \
  --force

Verify the Kubeless installation:

$ kubeless get-server-config

1.4. Install Promethues

Kubeless has native integration with Prometheus.

$ make install-prometheus
$ make install-grafana
Manual install with Helm
$ export MINIKUBE_IP=$(minikube ip)

$ helm upgrade prometheus stable/prometheus \
  --version 7.2.0 \
  --namespace monitoring \
  --values config/prometheus.yaml \
  --set server.ingress.hosts[1]=prometheus.${MINIKUBE_IP}.nip.io \
  --install \
  --wait \
  --timeout 600 \
  --force

$ helm upgrade grafana stable/grafana \
  --version 1.16.0 \
  --namespace monitoring \
  --values config/grafana.yaml \
  --set ingress.hosts[1]=grafana.${MINIKUBE_IP}.nip.io \
  --install \
  --wait \
  --timeout 600 \
  --force

1.5. Install NATS

NATS is a simple, high performance open source messaging system for cloud native applications, IoT messaging, and microservices architectures. Kubeless has native support for NATS in addition to Kafka.

Install the NATS server:

$ make install-nats
Manual install with Helm
$ helm upgrade nats stable/nats \
  --namespace nats \
  --values config/nats.yaml \
  --install \
  --wait \
  --timeout 600 \
  --force

1.6. Install Minio

Minio is a high performance distributed object storage server, designed for large-scale private cloud infrastructure.

Download the Minio client CLI:

Architecture Download
Mac https://dl.minio.io/client/mc/release/darwin-amd64/mc
Linux https://dl.minio.io/client/mc/release/linux-amd64/mc
Windows https://dl.minio.io/client/mc/release/windows-amd64/mc.exe

Install the Minio server:

$ make install-minio
Manual install with Helm
$ helm upgrade minio stable/minio \
  --namespace minio \
  --values config/minio.yaml \
  --install \
  --wait \
  --timeout 600 \
  --force

Configure Minio client

Set up the mc client command line utility to communicate with the Minio installation.

$ make configure-minio-client
Manual configure Minio client
$ export MINIKUBE_IP=$(minikube ip)
$ mc config host add local \
  http://${MINIKUBE_IP}:30900 \
  AKIAIOSFODNN7EXAMPLE \
  wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \
  --api "S3v4" \
  --lookup "path"

Verify Minio client setup:

$ mc ls --recursive local

2. Labs

  1. Creating Functions
  2. Function Depenendies
  3. HTTP Triggers
  4. Monitoring Functions
  5. Serverless Application

3. Tips and Tricks

Kubeless UI

You can use the Kubless UI to view and manage functions by going to kubeless.minikube in your browser.

Minio UI

You can use the Minio UI to view and manage buckets by going to minio.minikube in your browser.

Example Functions

License

MIT License