An open API service indexing awesome lists of open source software.

https://github.com/wpernath/knative-workshop

A tutorial repository to discuss benefits of serverless in a kubernertes environment
https://github.com/wpernath/knative-workshop

helm knative-serving kubernetes openshift-v4 serverless

Last synced: 22 days ago
JSON representation

A tutorial repository to discuss benefits of serverless in a kubernertes environment

Awesome Lists containing this project

README

        

# knative-workshop
This is a simple demo project to demonstrate knative-serving. If you want to follow this demo, please use a recent OpenShift 4.8+ cluster (either CodeReady Containers or SNO). And install OpenShift Serverless.

## Using the Web UI
- Install person-service helm chart
- Click on "Make serverless"
- Add an environment variable APP_GREETING with some nice content
- Click on Edit Service to make the ksvc use the database:

```YAML
envFrom:
- prefix: DB_
secretRef:
name: ps1-db-pguser-ps1-db
```

- Demonstrate that it works now.
- Wait a bit until it settled down

## A/B Deployments
- Go to the console
- Deploy a new version

```bash
kn service update ksvc-ps1-deployment --image=quay.io/wpernath/person-service:v1.8.10-jvm --env APP_GREETING="We are now in JVM mode"
kn revision list
https --verify=no ....
```

- Tag the two (useable) revisions

```bash
kn service update ksvc-ps1-deployment --tag=ksvc-ps1-deployment-00003=jvm
kn service update ksvc-ps1-deployment --tag=ksvc-ps1-deployment-00002=native
kn revision list
```

- Now update the service to get only one or the other tag (A/B deployments)

```bash
kn service update ksvc-ps1-deployment --traffic native=100,jvm=0
kn service update ksvc-ps1-deployment --traffic native=0,jvm=100
```

## Canary Deployments
- The only difference to A/B is that we are going to have traffic splits between the old and the new version

```bash
kn service update ksvc-ps1-deployment --traffic native=80,jvm=20
watch -n1 http ....
```

## Autoscaling
- New namespace
- Create the knative helm chart
- Install it twice with --set deployment.tag=jvm|native

```bash
helm package knative-chart
helm install ps1-native
helm install ps1-jvm --set deployment.tag=jvm

```
- Do load test with `hey`

```bash
hey -T application/json -c 16 -n 32000
```