- Docker
- https://knative.dev/docs/getting-started/
- minikube version v1.31.1+ to support Kubernetes version 1.27
- Knative CLI
brew install knative/client/kn
- Install Knative Quickstart
brew install knative-sandbox/kn-plugins/quickstart
- Install Knative Functions plugin - https://github.com/knative/func/releases
-
Start Kubernetes cluster locally with
minikube
kn quickstart minikube --kubernetes-version 1.27
-
Start a separated terminal for a tunnel
minikube tunnel --profile knative
-
Create function
kn-func create -l node knative-example
-
Install dependencies locally
npm install
-
Run the function
cd knative-example && kn-func run --registry docker.io/unfor19
-
Test the function
cd knative-example && npm test
-
Rebuild the function Docker image
cd knative-example && kn-func build --registry docker.io/unfor19
-
Push the function to the Kubernetes cluster
cd knative-example && kn-func deploy --build --registry docker.io/unfor19
-
Create the function as a service for the first time
kn service create knative-example \ --image docker.io/unfor19/knative-example:latest \ --port 8080 \ --env TARGET=initial-value
-
Test the deployed service http://knative-example.default.127.0.0.1.sslip.io?hello=world
cd knative-example && npm test
curl -L http://knative-example.default.127.0.0.1.sslip.io?hello=world
-
Update the service
kn service update knative-example \ --image docker.io/unfor19/knative-example:latest \ --port 8080 \ --env TARGET=updated