This repository contains my notes for how to quickly provision a local environment for tinkering with OpenFaaS.
brew update && brew install helm kind helmfile faas-cli
helm plugin install https://github.com/databus23/helm-diff --version v3.0.0-rc.7
- at the time of writing this, there wasn't a stable release of the diff plugin, but this required to avoid errors with helm3 and using helmfile
kind create cluster
- Ensure you're using the kind cluster context with kubectl:
kubectl config set current-context kind-kind
- Verify the cluster is working:
kubectl get nodes
- Install OpenFaaS to the local kind cluster:
helmfile apply
- Show the state of the installed chart:
helm list -n openfaas
- Wait for OpenFaaS pods to become ready:
kubectl get po -n openfaas --watch
- Add
127.0.0.1 gateway.openfaas.local
to/etc/hosts
to map the default host entry for OpenFaaS ingress - Open http://gateway.openfaas.local:30080/ui/ to verify you can see the OpenFaaS UI
This does nothing more than download the community template for node10 functions, which uses express under the covers.
- Pull the community node10 template:
faas-cli template store pull node10-express
- according to the OpenFaaS docs, this leverages a more performant implementation for functions
- Use the template to scaffold a function:
faas-cli new --lang node10-express hello-world --gateway http://gateway.openfaas.local:30080
- Build the docker image for the function:
faas-cli build -f hello-world.yml
- Load the image into kind so it can be deployed:
kind load docker-image hello-world:latest
- Deploy the function:
faas-cli up --skip-push -n openfaas-fn --update -f hello-world.yml --gateway http://gateway.openfaas.local:30080
- You can now interact with the function with the OpenFaaS UI at http://gateway.openfaas.local:30080/ui/
When you're done, you can wipe the slate clean by running:
kind delete cluster
- Investigate using knative build with OpenFaaS
- Investigate kind configuration that allows for a NodePort mapping to avoid having to run port forwarding commands
- https://kind.sigs.k8s.io/docs/user/quick-start#mapping-ports-to-the-host-machine
- Chose nginx for now, since I'm familiar with that
- Spent time on Contour, which looks promising, but would require more work to write ingress config via their CRDs
- Briefly looked at Gloo Ingress, but their helm chart leaves a lot to be desired
- Use a private local registry to avoid having to do a
kind load foo
each time the function is rebuilt - Create a node 12 hapi-based template, possibly submit it to OpenFaaS
- Add OIDC-based authentication