The following six blogs will expounding the architecture principle of Knative and source code analysis as much as possible. First, introduce some concepts in Knative, such as:
- Configuration
- Revision (Revision)
- Route
- Service (Service)
Configuration and Revision
The Serving component in Knative starts atConfiguration. We are inConfigurationDefines the required states for the deployment. Minimal Configuration includes at least a Configuration name and a reference to the container image to deploy. In Knative, a reference is defined as Revision. Revision represents an immutable snapshot of the code and Configuration at one point in time. Each Revision refers to a specific container image and any specific objects (such as environment variables and volumes) needed to run it. However, you don’t have to create Revision explicitly. Since revisions are constant, they are never changed or deleted. Instead, Knative creates a Revision when you modify the Configuration. This allows a Configuration to both reflect the current state of the workload and maintain its own list of historical revisions. The following is an example of Configuration that is deployed:Here is an example of Revision that is deployed:
Route
Routes in Knative provide a mechanism for routing traffic to running code. It maps a named, HTTP addressable endpoint to one or more Revisions. The Configuration itself does not define a Route.
Here is an example of a router that has been deployed,This route means that 100% of the traffic is sent toconfigurationName=helloworld-go
theConfigurationThe lastestReadyRevision
Service (Service)
In Knative, services manage the entire life cycle of a workload. This includes deployment, routing, and rollback. Do not confuse Knative Service with Kubernetes Service. They are different resources.) The Knative Service controls a series of routes and configurations that make up the software. A Knative Service can be thought of as a piece of code — an application or function that you are deploying.
A Service is careful to ensure that an application has a Route, a Configuation, and a new Revision for each Service update. When you create a Service without specifically defining a Route, Knative creates a Route that sends traffic to the latest Revision. You can select a specific Revision to route traffic to it.
Here is the deployed service,Revisions tracked by the service are specified in the Status description