- install CLI: https://knative.dev/docs/client/
- install the Knative operator:
kn operator install -n knative-operator - install Knative Serving:
kn operator install --component serving --kourier - get the kourier external IP:
kubectl get svc kourier -n knative-serving - set a wildcard domain:
kubectl patch configmap config-domain \
-n knative-serving \
--type merge \
-p '{"data":{"51.210.89.24.sslip.io":""}}'
- ```
## 🚀 Knative serving 🚀
- `01-create-mks-ns.sh`: create the `hello-world` namespace: `kubectl create ns hello-world`
- `02-deploy-service.sh`: deploy service application: `kn service create helloworld-from-quarkus --env COLOR="blue" --image wilda/hello-world-from-quarkus:1.2.0 -n hello-world`
- wait for the scale to zero (20s)
- `03-test-service.sh`: test application: `curl http://helloworld-from-quarkus.hello-world.51.210.89.24.sslip.io/hello`
- `04-list-service-revisions.sh`: list the current application revisions: `kn revisions list -n hello-world`
- `05-deploy-green-service.sh`: deploy a new version of the application: `kn service update helloworld-from-quarkus -n hello-world --env COLOR="green"`
- `03-test-service.sh`: test application: `curl http://helloworld-from-quarkus.hello-world.51.210.89.24.sslip.io/hello`
- `06-split-traffic-service.sh`: split the traffic between the two revisions: `kn service update helloworld-from-quarkus --traffic helloworld-from-quarkus-00001=50 --traffic @latest=50 -n hello-world`
- `04-list-service-revisions.sh`: list the current application revisions: `kn revisions list -n hello-world`
- `03-test-service.sh`: test application: `curl http://helloworld-from-quarkus.hello-world.51.210.89.24.sslip.io/hello`
- `03-test-service.sh`: test application: `curl http://helloworld-from-quarkus.hello-world.51.210.89.24.sslip.io/hello`
- `07-delete-service.sh`: delete the service: `kn service delete helloworld-from-quarkus -n hello-world`
## 🧩 Knative function 🧩
- `08-create-function.sh`: create a function: `kn func create -l quarkus ../say-message`
- set the `DOCKER_HOST`: `export DOCKER_HOST=unix:///Users/sphilipp/.rd/docker.sock`
- DOCKER_DEFAULT_PLATFORM=linux/amd64 kn func build --registry=wilda
- `09-local-run-function.sh`: build and run the function locally: `kn func run --build=false --registry=wilda -p ../say-message`
- `10-local-test-function.sh`: test locally: `kn func invoke -p ../say-message` or `curl localhost:8080 -H "Content-Type:application/json" -d "{\"message\": \"👋, Hello World\"}\""`
- `11-build-function.sh`: build the function: `kn func build --registry=wilda -b=s2i --platform=linux/amd64 -p ../say-message`
- (Optional) `12-push-function-image.sh`: push the image in the registry: `docker push wilda/say-message:latest`
- `13-create-say-message-ns.sh`: create a namespace: `kubectl create ns say-message`
### 🐧 Optional - On a linux environment 🐧
- build the function: `func build --registry=wilda`
- push the image in the registry: `docker push wilda/say-message:latest`
### 🍏 On the local environment 🍏
- `14-remote-deploy-function.sh`: deploy the function: `kn func deploy --build=false --push=false --image=docker.io/wilda/say-message:latest@sha256:0db1662858fa0b5849875219e41a30b4abd72e7fcb1000d1ee0ad038b8bb63df -n say-message -p ../say-message`
- `15-list-remote-function.sh`: get the function URL: `kn func list`
- `16-test-remote-function.sh`: test remotely: `curl http://say-message.say-message.51.210.89.24.sslip.io -H "Content-Type:application/json" -d "{\"message\": \"👋, Hello World\"}\""`
- `17-delete-remote-function.sh`: remove the function: `kn func delete say-message -n say-message`
## ⚡️ Knative eventing ⚡️
- install the in memory broker: `kn broker create in-memory-broker --class MTChannelBasedBroker`
- TODO... use eventing 😉
## 🗑️ Clean MKS 🗑️
- `99.2-ovh-kube-clean.sh`: delete created namespaces: `kubectl delete ns hello-world say-message`