Difficulty: Beginner
Estimated Time: 20

What is Knative?

Knative brings the "serverless" experience to kubernetes. It also tries to codify common patterns and best practices for running applications while hiding the complexity of doing so on kubernetes. It does so by providing two components:

  • Eventing - Management and delivery of events
  • Serving - Request-driven compute that can scale to zero

What will we learn in this tutorial?

This tutorial will serve as an introduction to Knative. Here we will install Knative (Serving only), deploy an application, watch Knative's "scale down to zero" feature then deploy a second version of the application and watch traffic split between the two versions.

Getting Started with Knative Serving (yaml)

Step 1 of 3

Step 1

Installation

The startup script running on the right will wait for kubernetes to start. Once you see a prompt, you can click on the commands below at your own pace, and they will be copied and run for you in the terminal on the right.

  1. Install Knative Serving's core components
     kubectl apply --filename https://github.com/knative/serving/releases/download/${latest_version}/serving-crds.yaml
     kubectl apply --filename https://github.com/knative/serving/releases/download/${latest_version}/serving-core.yaml
    
  2. Install contour as the networking layer. (Knative also supports Courier, Gloo, Istio and Kourier as options)
     kubectl apply --filename https://github.com/knative/net-contour/releases/download/${latest_version}/contour.yaml
     kubectl apply --filename https://github.com/knative/net-contour/releases/download/${latest_version}/net-contour.yaml
    
  3. Configure Knative Serving to use Contour by default
     kubectl patch configmap/config-network \
       --namespace knative-serving \
       --type merge \
       --patch '{"data":{"ingress.class":"contour.ingress.networking.knative.dev"}}'