Skip to content

OpenFaaS makes it easy for developers to deploy event-driven functions and microservices to Kubernetes without repetitive, boiler-plate coding. Package your code or an existing binary in a Docker image to get a highly scalable endpoint with auto-scaling and metrics.

majidkarimizadeh/openfass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 

Repository files navigation

Faas-cli

Installing faas cli on Mac

brew install faas-cli

Browse available templates from the official store

faas-cli template store list

Browse existing functions

faas-cli list

Describe the function

#faas-cli describe <FUNCTION_NAME>
faas-cli describe node-hello-world

Deploy openfass to a Kubernetes cluster

Install arkade

brew install arkade

Install openfaas

arkade install openfaas

Get openfaas info

arkade info openfaas

Forward the gateway to your machine

kubectl rollout status -n openfaas deploy/gateway
kubectl port-forward -n openfaas svc/gateway 8080:8080

If basic auth is enabled, you can now log into your gateway

PASSWORD=$(kubectl get secret -n openfaas basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode; echo)
echo -n $PASSWORD | faas-cli login --username admin --password-stdin

List openfass function pods

# kubectl get pods -n <NAMESPACE>
kubectl get pods -n openfaas-fn

Create and deploy function

Generate a function

# faas-cli new <FUNCTION_NAME> --lang <TEMPLATE>
faas-cli new node-hello-world --lang node12

Make sure in the node-hello-world.yml file you changed the image attribute and pointed it to the correct registry path.

Build the function

# faas-cli build -f <FUNCTION_NAME>.yml
faas-cli build -f node-hello-world.yml

Push the function to the registry

# faas-cli push -f <FUNCTION_NAME>.yml
faas-cli push -f node-hello-world.yml

Deploy the function

# faas-cli deploy -f <FUNCTION_NAME>.yml
faas-cli deploy -f node-hello-world.yml

Alternative command for build, push and deploy

# faas-cli up -f <FUNCTION_NAME>.yml
faas-cli up -f node-hello-world.yml

Remove function

# faas-cli rm -f <FUNCTION_NAME>.yml
faas-cli rm -f node-hello-world.yml

List functions

faas-cli list

Describe the function

# faas-cli describe <FUNCTION_NAME>
faas-cli describe node-hello-world

https://www.openfaas.com/

https://chaoscodes.github.io/2019/06/11/My-first-try-in-OpenFass/

About

OpenFaaS makes it easy for developers to deploy event-driven functions and microservices to Kubernetes without repetitive, boiler-plate coding. Package your code or an existing binary in a Docker image to get a highly scalable endpoint with auto-scaling and metrics.

Resources

Stars

Watchers

Forks