Technology Stack:
- Python
- Serverless
Instead of managing servers directly, your applications can scale automatically in response to events, scaling down to zero when idle, which can improve resource efficiency and cost management. In this workspace, you will be required to quickly build an application image, upload it to the internal repository and then load balance it with Red Hat Serverless!
- Create a new project/namespace from the openshift ui and name it
<username>-serverless
- From the openshift UI, start a new terminal
- 2.1. Type in
oc project
to see which project you have enabled - 2.2. Type in
kn
to download the k-native CLI
- Create your first Knative service
kn service create module4-helloworld \
--image quay.io/pknezevich/module4-dotnet-hellolang \
--autoscale-window 20s \
--env countryCode=DE
- Verify your service has been created and you can curl/navigate to your application
- Tag the revision to green
- NOTE: we will update with ENV VAR but typically you would use:
kn service update <service-name> --image <new-image>
kn service update module4-helloworld \
--env countryCode=DE \
--tag module4-helloworld-00001=blue --untag green \
--tag @latest=green \
--traffic blue=100,green=0
- Tag the blue revision to inactive
- To create a third revision:
- 8.1. From OC change the tag from
module4-helloworld-00002
green to blue - 8.2. Create a new revision
- 8.2.1. ENV change (quick revision, this is usually done via an image change)
- 8.2.1.1. Change a different country code
- 8.2.2. Tag the old revision to blue
- 8.2.3. Do not allow any traffic to new revision until you’re ready to (traffic distribution still stays on blue)
- 8.2.1. ENV change (quick revision, this is usually done via an image change)
kn service update module4-helloworld \
--env countryCode=FR \
--tag module4-helloworld-00002=blue --untag green \
--tag @latest=green \
--traffic blue=100,green=0
- Build a 3-revision load-balanced environment with 3 different country languages, distribute the traffic evenly between each (33%)
- Add a new image as a revision -
quay.io/pknezevich/helloworld-v2
kn service update module4-helloworld \
--image quay.io/pknezevich/helloworld-v2 \
--env countryCode=IT \
--tag module4-helloworld-00001=blue --untag green \
--tag @latest=green \
--traffic blue=100,green=0
- Design your current environment - canary, blue/green, knife edge
- You can rename the revision tags to whatever you’d like them to be
- First time approach to Red Hat’s Serverless Scale-to-zero and auto-scaling
- Understanding Revisions and Introduced ‘image tagging’ to your container image
- Demonstrated blue-green deployment
- Demonstrated canary deployments (using traffic distribution)
- Demonstrated a knife-edge cutover