Serverless Canary Deployment using Knative

Serverless refers to a cloud computing model whereby application developers don’t have to provision servers or manage scaling for their app. Instead, those routine tasks are abstracted away by the cloud provider, allowing developers to push code to production much faster than in traditional models.

In short, serverless lets developers focus on their code, and mostly ignore the infrastructure. Hence “serverless” because the server specifications don’t affect developers. Of course, the servers do still exist — it’s just that they are managed by the cloud provider.

This is step by step instruction for demonstrating Canary Deployment with knative. Application in this demo is using my custom apps on Application will consume message from Kafka Topic and stream to REST API.

Demo scenario:

Demo Scenario


  • Openshift Container Platform 4.4
  • Install OpenShift Serveless or knative using operator
  • Install knative (kn) CLI
  • Preinstalled Kafka on Openshift using

Step 0: Login to Openshift CLI and choose designated namespace

$ oc login$ oc new-project erfin-serverless-demo

Step 1: Deploy knative apps v3

$ kn service create quarkus-kafka-consumer \
--image \
--revision-name quarkus-kafka-consumer-v3 \

Step 2: Revise knative apps v4 and distribute 50% traffic

$ kn service update quarkus-kafka-consumer \
--image \
--revision-name quarkus-kafka-consumer-v4
--traffic quarkus-kafka-consumer-v4=50 \
--traffic quarkus-kafka-consumer-v3=50 \

or using Openshift web console:


  • quarkus-kafka-consumer-v3 is previous service revision name.
  • new service v4 will serve 50%, previous service v3 will serve 50%

Result on OpenShift Console

Step 4: Check service status

$ kn service describe quarkus-kafka-consumer


Name:       quarkus-kafka-consumer
Namespace: erfin-demo
Age: 21m
50% quarkus-kafka-consumer-v4 (current @latest) #v4 [2] (19m)
Image: (pinned to 09d28f)
50% quarkus-kafka-consumer-v3 #v3 [1] (21m)
Image: (pinned to 09d28f)
++ Ready 6s
++ ConfigurationsReady 6s
++ RoutesReady 1m

Step 5: Invoke the Service

invoke stream API on your browser or using curl

$ curl

Or result on browser page:


Deploy demo apps for kafka message producer from my previous tutorial. link will be updated.


Kuli Ketik dan AppDev Solution Architect at Red Hat. Eat, Code, Sleep — repeat.