knative-demos icon indicating copy to clipboard operation
knative-demos copied to clipboard

Collection of Knative demos

Knative demos

This repository contains a collection of demos I use in different technical sessions about Knative (e.g. Generating Events from Your Internal Systems with Knative). I try to keep these updated as new versions of Knative get released but sometimes I may get behind. Do let me know (issue) if you find something that's not working.

For the complete list of official Knative samples see docs repository.

Setup

To run these samples you need to a Knative cluster. If you don't have one, you can use the quick setup steps for GKE including static IP, custom domain and a few other post install configurations.

For official documentation on how to install and configure Knative on variety of Kubernetes services see the Knative install documentation

Demos

Follow these instructions to run the demos in the presentation:

  • Deploying a pre-build image
    • Using kubectl
    • Using kn CLI
  • On-cluster build using Tekton
    • Csharp build using Kaniko
    • Java/Kotlin/Groovy/Scala build using Jib
  • Cloud (serverless) builds
    • Build and deploy using GitHub Actions
    • Build and deploy using Cloud Build
  • Configuring Knative application
    • Internal (cluster-local) services
    • Automatic scaling
    • Limit RAM/CPU resources or require GPU
  • Operations (Day 2)
    • Traffic splitting, blue/green updates
  • Eventing
    • Processing IoT core events
    • Twitter processing pipelines

Monitoring

Note, the monitoring/observability components require additional install

Run the following command to watch your Kubernetes pods while running the demos:

kubectl port-forward -n knative-monitoring  \
    $(kubectl get pods -n knative-monitoring --selector=app=grafana \
    --output=jsonpath="{.items..metadata.name}") 3000

Tracing

To enable event tracing first edit the tracing config

kubectl edit cm config-tracing -n knative-eventing

In this case I'm using Stackdriver so just add the following two lines. You can also use zipkin in which case you will also have to define the back-end. See the config map's comments for details.

  backend: stackdriver
  sample-rate: "1.0"

If you're tracing high volume events you may want to adjust the sample-rate to something smaller like 0.1 (10% of all events).

To view traces, navigate to the Trace UI in GCP console