--- title: OpenFaaS and Kubernetes date: 2017-08-27 18:30:00 --- Recently there has been a lot of news about [OpenFaaS](https://github.com/alexellis/faas) and I wanted to try it out. As the rest of my tests have been done on Kubernetes, I looked more closely to the [FaaS-Netes](https://github.com/alexellis/faas-netes). Everything here was done on a local minikube deployment and using my test Docker registry deployed on a server in the local network. ## Deployment The first deployment was really easy. Once minikube is operational, it's only two commands to deploy everything needed : `git clone https://github.com/alexellis/faas-netes` and then `kubectl apply -f ./faas.yml,monitoring.yml,rbac.yml`. You can check on the status of everything either through the Kubernetes dashboard (using `minikube dashboard` if you don't know the IP) or using the OpenFaaS dashboard (through the port *31112*). The second part is to get the OpenFaaS-cli tools that allows easy function deployment. As I'm not a huge fan of the `curl -sSL ... | sudo sh` install method, I downloaded manually the executable from the [release page](https://github.com/alexellis/faas-cli/releases) and added it the PATH. ## Use of a private Docker registry Before this, I always deployed my stuff by hand of the Kubernetes cluster and thus had no problems with the authentication using the *imagePullSecrets* in the yaml deployment file. This time as OpenFaaS deploys containers as needed, I had to configure the nodes to authenticate automatically. Fortunately, it was this easy : * Create the secret ``` bash $ kubectl create secret docker-registry myregistrykey \ --docker-server=registry.local \ --docker-username=user \ --docker-password=pass \ --docker-email none@registry.local ``` * Modify the service account to add `imagePullSecrets` to every image pull ``` bash $ kubectl patch serviceaccount default \ -p '{"imagePullSecrets": [{"name": "myregistrykey"}]}' ``` * It works. ## First test I the followed the [Your first serverless Python function with OpenFaaS](https://blog.alexellis.io/first-faas-python-function/) blog post by the creator of the system. First creating a new directory for this function and adding the basic content needed for an Hello World ``` bash $ mkdir -p ~/functions/hello-python $ cd ~/functions $ cat > hello-python/handler.py < stack.yml <