OpenFaaS At The Helm w/ Kubernetes in the DevNet Sandbox
Serverless is one of the fastest growing architectural paradigms for software right now. Not so strange when you think about it, as serverless lets developers execute code in response to events, reducing complexity and the consideration of where and when the code is executed. The biggest problem to overcome in this space is how to make use of serverless in a simple way and not get tied to a cloud vendor. I have had the pleasure of being a contributor to an open source project called OpenFaaS that is helping to disrupt the serverless industry and inspire a new wave of application growth. Like Kubernetes has done in making experiences with container orchestration the same across cloud vendors and on-premise data centers, OpenFaaS aims to run on any functions as a service (FaaS) compute, on any cloud / on-prem, anywhere!
As is the tradition with Cisco DevNet, we are here to guide you in getting up and running quickly with OpenFaaS, and help you start your journey in developing serverless applications. This blog is the first in a series of guides to help you easily get started with OpenFaaS and serverless.
With Kubernetes (k8s) serverless has never been easier with OpenFaaS. OpenFaaS allows managing serverless functions in k8s and docker swarm easy. We will use a script written by the Cisco DevNet team that installs Helm (k8s package manager) and OpenFaaS CLI, and uses these tools to help us easily install OpenFaaS on a k8s cluster.
To do this we will be using a secure k8s environment from Cisco DevNet Sandbox. Using the DevNet Sandbox version of k8s provides a secure and powerful testbed for k8s and our deployment of OpenFaaS. To set up your environment with k8s in the DevNet Sandbox, please use this guide to get started.
After following the guide to have your environment setup and after you have VPNed into your environment reservation, you can ssh into the kube adm host using the credentials
username: root, password: cisco123.
$ ssh firstname.lastname@example.org
Once you have SSHed into the kubeadm host, in your terminal window, issue the following command (Copy and paste after the $ sign as needed):
$ curl -O https://raw.githubusercontent.com/CiscoDevNet/k8s_openfaas/master/openfaas_helm.sh \ && chmod +x ./openfaas_helm.sh \ && ./openfaas_helm.sh
When the script is complete, in your browser, navigate to http://10.10.20.1:31112 to verify that OpenFaaS is running.
After verifying that OpenFaaS is running, we will use the OpenFaaS CLI to start some sample functions.
$ faas-cli deploy -f https://raw.githubusercontent.com/openfaas/faas-cli/master/samples.yml --gateway http://10.10.20.1:31112
Now, refresh the OpenFaaS web page at http://10.10.20.1:31112/ui/. You should see that your functions are available.
Click on the url-ping function and test it is running, by typing in a web url into the request body and then click invoke to see that your sample functions are working.
Now you truly have serverless on your own terms.
Call To Action
Deploy your first Golang function: https://blog.alexellis.io/serverless-golang-with-openfaas/
Get more familiar with OpenFaas CLI: https://blog.alexellis.io/quickstart-openfaas-cli/
Star the OpenFaaS repo and find out why so many people are choosing OpenFaaS.
Check out the talk in Austin, Tx at KubeCon 2017 with OpenFaas: https://www.youtube.com/watch?v=XgsxqHQvMnM
For more instruction, See also:
Copyright OpenFaaS Ltd