Knative is a Kubernetes-based platform that simplifies the deployment of serverless workloads. It provides powerful building blocks such as event-driven computing and autoscaling capabilities, making it ideal for building scalable cloud-native applications.
Key features of Knative include:
- Knative Serving: Run serverless containers with advanced routing, autoscaling, and rollout capabilities.
- Knative Eventing: Build event-driven architectures using cloud events.
This repository provides a template to quickly bootstrap Knative-based services.
- Install the Knative client:
brew install knative/client/kn
- Install the Knative kn-plugins:
brew tap knative-extensions/kn-plugins
- Install the func:
brew install func
- Download the func binary for Ubuntu:
wget https://github.com/knative/func/releases/download/knative-v1.16.1/func_linux_amd64
- Make the binary executable:
chmod +x func_linux_amd64
- Move the binary to a directory in your PATH:
sudo mv func_linux_amd64 /usr/local/bin/func
To create a new function, use the provided template:
make gen-functionRedis can be used to manage state or as a message broker. Redis client can be enabled with following environment variables.
REDIS_HOST='' REDIS_PORT=6379 REDIS_USER=redis_user # if exists REDIS_PASS=redis_pass # if password is enabled REDIS_ENABLED=trueLogging is crucial for monitoring and debugging. To see the logs of your application go to the following link. And choose your function.
grafana credentials: login: ucode-dev password: sie0eeBuZ3Neigageejo Make sure that func is installed on your laptop by running the command, func version.
Build image:
make build-functionRun container: You have to give external container port for PORT parametr
make run PORT=8888Stop image:
make stopYou can send request to the faas in local with the url: http://localhost:PORT/.
Inside the ./faas/main.go you can build another paths too. But it is only recommended for specific cases.
For more details or support, feel free to raise issues in this repository.