Demo-Magic Scripts to install and demo Knative's Serving and Eventing
Hi curious visitor 👋
Knative is the most popular platform to run Serverless workload on Kubernetes. It's two building blocks Serving and Eventing are providing a rich set of features in order to support you in running your Serverless workload as well as to build Event-Driven architectures. Implementation-details like e.g. the reactive Knative Pod Autoscaler making it possible to scale your workload from n to 0(!) and vice versa. Also, features like Revisions and Routes making deployment models like Blue/Green, Canary and Progressive available and thus providing great flexibility in shipping your code to production.
This repository provides two demo-scripts I've created to demo Knative's power in the mentioned disciplines. By cloning this repository, you will have two scripts by hand, which will install the two aforementioned building blocks to an existing Kubernetes installation plus demos for each. But don't think about a classical installation script (execute -> finish)! The idea is basically, you execute a script, it'll start typing the first command for you and stops until you execute. Therefore, you can keep focus on your presentation and continue when you are ready. I've e.g. used the scripts multiple times when presenting on Knative. I'm using the popular Demo Magic script/tool to do so.
📖 Table of Content
💻 CLI Tools
In order not being disrupted by a missing cli tool during the script execution, install (or replace a tool withing the script) the following cli tools:
🔧 Preperations
Clone the repository locally and change into the new directory knative_serving_eventing_demo_script
.
git clone git@github.com:rguske/knative_serving_eventing_demo_script.git && cd knative_serving_eventing_demo_script
🏷️ Knative Release Versions
Open both scripts and adjust the respective release versions for the installations at the beginning of every script. You'll find the latest releases using the links below.
# adjust the versions for the serving installation (core and net-contour) in knative_serving.sh
export KN_SERVING='knative-v1.1.1'
export KN_CONTOUR='knative-v1.1.0'
# adjust the version for the eventing installation in knative_eventing.sh
export KN_EVENTING=knative-v1.0.2
Note: I've only tested both scripts successfully with the above release versions.
Note: If you like to use another networking-layer than Contour, modify the sections
04.
as well as05.
in theknative_serving.sh
script accordingly.
🛂 Load Balancer required
Because I'm using Tanzu Kubernetes Grid as a Kubernetes runtime, load balancing services is not a topic I have to worry about. Therefore, section 05.
in the knative_serving.sh
script is expecting that a load balancer will assign an IP address automatically to the Envoy Proxy (kubectl get service envoy -n contour-external --output 'jsonpath={.status.loadBalancer.ingress[0].ip}'
).
✨ Knative Magic locally on a KinD Cluster
If you don't have a Kubernetes playground available, check out Knative on Kind (KonK).
You are a Fusion or Workstation user? Check out vctl
to easliy instantiate a KinD cluster locally 👀 👉 A closer look at VMware's Project Nautilus
⭐ Eventing Demo vSphere-Tag
In order to provide a great Event-Driven-Architecture (EDA) experience on vSphere, the knative_eventing.sh
script will install the VMware Event Router using helm
, to connect to the vCenter Server event-stream (vCenter = event provider
) and to provide the stream to a broker. For the deployment of the Event-Router, it's important that you enter your vCenter parameters in section 06.
of the knative_eventing.sh
script.
Section 06:
cat << EOF > override.yaml
eventrouter:
config:
logLevel: info
vcenter:
address: https://<vcenter-server-address> # FQDN or IP
username: ro-user@vsphere.local # enter your read-only user
password: 'VMware1!' # enter your super secret password
insecure: true # specify if the connection is insecure or not
eventProcessor: knative
knative:
destination:
ref:
apiVersion: eventing.knative.dev/v1
kind: Broker
name: default
namespace: vmware-functions
EOF
Also, an example function from the official VEBA (VMware Event Broker Appliance) repository will be used for the eventing demo. It will apply a specified vSphere Tag to a Virtual Machine after it was powered on (DrsVmPoweredOnEvent
).
Adjust the values in the tag_secret.json
file accordingly before starting the knative_eventing.sh
script.
Note: Of course the vSphere Tag must also exist before you start the script 😉
{
// vCenter Server address (FQDN or IP)
"VCENTER_SERVER": "FILL-ME-IN",
//User with the right persmissions to apply a vSphere Tag
"VCENTER_USERNAME" : "FILL-ME-IN",
// Users password
"VCENTER_PASSWORD" : "FILL-ME-IN",
// vSphere Tag name
"VCENTER_TAG_NAME" : "FILL-ME-IN",
// Possible values are Fail, Ignore or Warn
"VCENTER_CERTIFICATE_ACTION" : "FILL-ME-IN"
}
🚀 Execute a Script
Simply start a script by executing e.g. ./knative_serving.sh
on your terminal and confirm the execution of each printed command. I recommend using tmux
and watch
(e.g. watch kubectl get pods -A
) or helpful tools like k9s or Octant to follow the installations on another terminal window.
Have Fun!