Get OpenFaaS running on Azure Container Service with Kubernetes

How to get OpenFaaS running on ACS? Read more!


Deploying ACS with Kubernetes

You can choose to deploy the ACS Kubernetes cluster using Azure CLI or acs-engine.
In this readme you can find a quick guide for the both.

Deploy the cluster with the Azure CLI

1) Install the official latest version of Azure CLI

2) Login to your subscription

az login

Optional: If you have multiple subscriptions linked to your account, remember to select the one on which you want to work. (az account set -s subscription-id)

3) Create the resource group in which you want to deploy the cluster (in the example k8sRG is the name of the Resource Group and westeurope is the chosen location)

az group create -l westeurope -n k8sRG

4) Finally, create your cluster. This will create a default cluster with one master and three agents (each VM is sized, by default, as a Standard_D2_v2 with 2vCPUs and 7GiB of RAM)

az acs create --orchestrator-type Kubernetes -g k8sRG -n k8sCluster -l westeurope --generate-ssh-keys

Optional: you can specify the agent-count, the agent-vm-size and a dns-prefix for your cluster

--agent-count 2 --agent-vm-size Standard_A1_v2 --dns-prefix k8sdanigian

5) Get your cluster credentials ready for kubectl

az acs kubernetes get-credentials -n k8sCluster -g k8sRG

Deploy the cluster with acs-engine

1) Download acs-engine

2) Download and eventually modify the cluster definition file (can find an example here)

3) Using the just downloaded cluster definition file (“kubernetes.json” in the example), execute acs-engine as below, in order to deploy your cluster on Azure Container Service:

./acs-engine deploy --subscription-id your-subscription-id-here \
--dns-prefix friendly-dns-prefix --location westeurope \
--auto-suffix --api-model ./kubernetes.json

4) After a successful deployment, acs-engine will output ssh keys and a list of kubeconfig files in the “_output” directory.
Please choose the JSON file corresponding to your region and use that to replace your kubeconfig file (you can usually find it in ${HOME}/.kube/config)

Deploy OpenFaaS to the newly created ACS Cluster

You may now use kubectl and go on with the deployment of OpenFaaS to your cluster.

1) Check if the kubectl configuration is ok and if your cluster is up-and-running

kubectl cluster-info

2) Clone the faas-netes repository

git clone

3) Deploy faas-netes to ACS

kubectl apply -f ./faas.yml,monitoring.yml

4) Optional: you may choose to expose the gateway to the internet. This could be useful to invoke functions from the internet.

kubectl edit svc/gateway

When the editor pops up, change the spec/type to LoadBalancer then save and close the file (NodePort is the default spec/type for the gateway).

Congratulations! You now have OpenFaaS deployed to your Azure Container Service!

If you already know what to do now, go ahead and do it!

Otherwise, you can try to deploy a “Hello World” .NET Core 2.0 function to OpenFaaS!

In order to do that, you will need a fully functioning Docker installation on your machine and an account on Docker Hub.

1) Install the OpenFaaS CLI

curl -sSL | sudo sh

2) Get the domain and port of your externally exposed gateway

kubectl get svc/gateway

3) Create a new C# Function

faas-cli new --name your-function-name --lang csharp --gateway=http://domain:port

4) Eventually, modify the code of your “Hello World” function

5) Build, push and deploy your newly created function.

faas-cli build -f your-function-name.yml [--no-cache]

faas-cli push -f your-function-name.yml

faas-cli deploy -f your-function-name.yml

The –no-cache option is optional but very useful when updating the code of your function

6) Test your function with CURL or Postman by just invoking it with a POST request to http://domain:port/function/your-function-name

Spread this article

3 Replies to “Get OpenFaaS running on Azure Container Service with Kubernetes”

  1. Johny Jackson says: Reply

    I think everything published was actually very logical.
    But, what about this? suppose you composed a catchier post title?

    I mean, I don’t wish to tell you how to run your website, but suppose you added
    something to maybe grab folk’s attention? I mean Get OpenFaaS running on Azure Container Service with Kubernetes – in love with technology is a little vanilla.
    You should glance at Yahoo’s home page and see how they write article headlines
    to grab people interested. You might add a video or a pic or
    two to grab readers excited about everything’ve written. In my opinion, it might bring your posts a little livelier.

    1. Thank you for your suggestion, I hope you liked the blog post even though the title was not so catchy.

  2. Johny Jackson says: Reply

    What’s Taking place i’m new to this, I stumbled upon this I’ve
    discovered It absolutely useful and it has helped me out loads.
    I hope to contribute & aid other users like its aided me.
    Great job.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.