Funktion on ACS(Kubernetes)


I try Funktion, which is an open source event driven lambda style programming model on top of Kubernetes. I'll explain how to configure Funktion on Azure Container Service. 

Deploy Azure Container Service (Kubernetes) with acs-engine

Deploy the Kubernetes cluster using acs-engine. It is totally same as the last post. Please refer the process. I recommend to use acs-engine. It is the latest version of kubernetes.

Configure the Funktion

1. download the funktion binary

Also add PATH environment variables.

2. install funktion platform

You can deploy the function platform using this command.
funktion install platform
You'll notice one of the pod doesn't work correctly.
$ kubectl get pods
NAME                                          READY     STATUS              RESTARTS   AGE

alertmanager-1642345671-w8jd2                 1/1       Running             0          21h

faas-netesd-2439127026-bcc6d                  1/1       Running             0          21h

funktion-combined-operator-4290768933-0ww0f   0/3       ContainerCreating   0          7s

You'll find a problem by the log.

$ kubectl logs funktion-combined-operator-3150707266-5kndz -c exposecontroller

I0919 19:29:38.222060       1 exposecontroller.go:46] Using build: '2.3.13'

I0919 19:29:38.318578       1 exposecontroller.go:79] Watching services in namespaces: ``

F0919 19:29:38.345560       1 exposecontroller.go:83] failed to create new strategy: failed to create ingress expose strategy: failed to get a domain: no known automatic ways to get an external ip to use with nip.  Please configure exposecontroller configmap manually see https://github.com/fabric8io/exposecontroller#configuration

If you want to solve this problem, you need to configure a YAML file which is used inside of the funktion command.

Download the YAML file. (In the near future, it will change the version. You can refer the latest version if you watch the log of the "funktion install platform" command.

https://repo1.maven.org/maven2/io/fabric8/funktion/packages/funktion-platform/3.0.3/funktion-platform-3.0.3-kubernetes.yml

Then Edit this part.  You need to require that you have your own domain. In this case, I use my domain "simplearchitect.club".  The "funktion" part, you can decide by yourself.

 data:

 config.yml: |

 domain: "funktion.simplearchitect.club"

 exposer: "Ingress"

then apply it.

kubectl apply -f funktion-platform-3.0.3-kubernetes.yml

It will update the configration

For more detail, you can refer the documentation to explain this part.

https://github.com/fabric8io/exposecontroller/

Configure Nginx Ingress controller

Then you need to configure Nginx ingress controller.
Clone this repo. Then deploy the
For more detail Deploying the Nginx Ingress controller
git clone https://github.com/kubernetes/ingress.git

 cd ingress

 cd examples/deployment/nginx/

 kubectl apply -f default-backend.yaml

kubectl apply -f nginx-ingress-controller.yaml

Then you need to expose nginx controller

$ kubectl get rs --namespace kube-system

NAME                                  DESIRED   CURRENT   READY     AGE

default-http-backend-2198840601       1         1         1         1h

heapster-3415618409                   1         1         1         1d

heapster-822306284                    0         0         0         1d

kube-dns-v20-1742650215               2         2         2         1d

kubernetes-dashboard-2968180124       1         1         1         1d

nginx-ingress-controller-3192290068   1         1         1         1h

tiller-deploy-3019137470              1         1         1         1d
You will find a reprica set of the nginx controller which you deployed. We need to expose the nginx ingress controller to the internet.
kubectl expose rs nginx-ingress-controller-3192290068 --port=80 --target-port=80 --name=nginx-ingress --type=LoadBalancer --namespace kube-system
You need to change the name of the Reprica Set name according to your environment. After few minutes, you will get the IP address of the ingress controller.
$ kubectl get svc --namespace kube-system

NAME                   CLUSTER-IP     EXTERNAL-IP     PORT(S)         AGE

default-http-backend   10.0.90.99     <none>          80/TCP          2h

heapster               10.0.8.187     <none>          80/TCP          1d

kube-dns               10.0.0.10      <none>          53/UDP,53/TCP   1d

kubernetes-dashboard   10.0.158.183   <nodes>         80:30884/TCP    1d

nginx-ingress          10.0.8.136     13.93.150.122   80:31517/TCP    1h

In this care, the IP address of the nginx-ingress is 13.93.150.122

Add a DNS entry for funktion

You need to add the DNS record for the nginx-ingress controller for Funktion. The entry name should much

 domain: "funktion.simplearchitect.club"
The setting which I edit for the yaml file.  If you create a "hello" function, the URL will be "hello.default.simplearchitect.club" in this case. You need to add "*" in front of the subdomain. I use Azure DNS for the configuration.
Now you are ready to deploy your function.
Create your first function
This is the same hello world application on the Funktion document.
git clone https://github.com/funktionio/funktion-nodejs-quickstart.git
cd funktion-nodejs-quickstart/
funktion install connector http4 timer twitter
cd funktion-nodejs-quickstart/
funktion create fn -f src/hello.js

Then you can see the URL by this command.

funktion get fn

NAME                             PODS      URL

hello                            1/1       http://hello.default.funktion.simplearchitect.club

Just open the browser

http://hello.default.funktion.simplearchitect.club?name=ushio

It works.

Enjoy serverless!

Resource

OpenFaaS on ACS (Kubernetes) You can refer how to configure ACS
* Funktion (Documentation)

Comments (0)

Skip to main content