Knative Serving code samples

Use the following code samples to help you understand the various Knative Serving resources and how they can be applied across common use cases. Learn more about Knative Serving resources.

See all Knative code samples

Name Description Languages
Hello World A quick introduction that highlights how to deploy an app using Knative Serving. C#, Go, Java, Kotlin, Node.js, PHP, Python, Ruby, Scala, Shell
Advanced Deployment Simple blue/green-like application deployment pattern illustrating the process of updating a live application without dropping any traffic. YAML
Autoscale A demonstration of the autoscaling capabilities of Knative. Go
Private Repo Build An example of deploying a Knative Serving Service using a Github deploy-key and a DockerHub image pull secret. Go
Buildpack for Applications A sample app that demonstrates using Cloud Foundry buildpacks on Knative Serving. .NET
Buildpack for Functions A sample function that demonstrates using Cloud Foundry buildpacks on Knative Serving. Node.js
Github Webhook A simple webhook handler that demonstrates interacting with Github. Go
gRPC A simple gRPC server. Go
Knative Routing An example of mapping multiple Knative services to different paths under a single domain name using the Istio VirtualService concept. Go
Knative Secrets A simple app that demonstrates how to use a Kubernetes secret as a Volume in Knative. Go
REST API A simple Restful service that exposes an endpoint defined by an environment variable described in the Knative Configuration. Go
Telemetry This sample runs a simple web server that makes calls to other in-cluster services and responds to requests with "Hello World!". The purpose of this sample is to show generating metrics, logs, and distributed traces. Go
Thumbnailer An example of deploying a "dockerized" application to Knative Serving which takes video URL as an input and generates its thumbnail image. Go
Traffic Splitting This samples builds off the Creating a RESTful Service sample to illustrate applying a revision, then using that revision for manual traffic splitting. YAML