Deploying and running a sample function on OpenFaaS
This section will cover the creation, build, and deployment of a new FaaS Python function. We’ll also use OpenFaaS CLI commands to test the deployed function.The OpenFaaS CLI has a template engine that can be used to set up new functions in any programming language. To create a new function, use the following command:
faas-cli new –lang <language template> ––prefix localhost:32000 <function name>
Here –prefix
localhost:32000
refers to the local MicroK8s registry that we have enabled in the preceding steps.
This command works by reading a list of templates from the ./template
directory in your current working folder.
You can also use the faas-cli template pull
command to pull the templates from the official OpenFaaS language templates from GitHub.
To check the list of languages that are supported, use the faas-cli new –list
command.
The following command execution...