What is Knative? K for Kubernetes + Native
Knative enables serverless workloads to run on Kubernetes clusters, and makes building and orchestrating containers with Kubernetes faster and easier.
Why Kubernetes needs Knative
Sometimes, Kubernetes could be a complex tool for develops while during the container orchestration: template multiple repetitive tasks, pulling code from remote repo, provisioning container image. And the most difficult part is to incorporating Kubernetes-managed resources into another CI/CD pipeline, because that will need custom coding and setup to smooth the pipeline, such as configuring network connections. That;s why we look Knative for help.
Knative utilize one single YAML manifest file to creating the containers, performing network manipulation, also taking care of load balancing.
Making containers serverless
Serverless computing have several characteristic that differentiate itself from traditional computing model:
- Provisions computing resources on demand, scaling transparently based on requests - and scaling to zero when requests are no longer made.
- Offloads all infrastructure management tasks - scaling, scheduling, patching, provisioning, etc. - to the cloud provider, allowing developers to focus their time and effort on development and innovation.
- Enables cloud customers to pay only for resources being used - they never pay for idle capacity.
All in all: event driven architecture run on cloud infrastructures and pay as you go.
How Knative works: Knative components
Knative sits on top of Kubernetes and adds three main components: Build, Serving, and Eventing.
Build
Knative uses Kubernetes APIs and other tools for its Build process. A developer can create a single manifest (typically a YAML file) that specifies all the variables - location of the source code, required dependencies, etc. - and Knative uses the manifest to automate the container build.
- Pulling source code from a code repository, such as GitHub
- Installing the underlying dependencies—such as environment variables and software libraries—that the code needs to run
- Building container images
- Putting container images into a registry where Kubernetes (and other developers) can find it.
Serving
The Serving component deploys and runs containers as scalable Knative services. Serving provides the following important capabilities:
- Configuration defines and maintains the state of a service. It also provides version management: Each modification to the configuration creates a new version of the service, and previous versions are saved.
- Intelligent service routing lets developers route traffic to different versions of the service. Suppose you’ve created new version of a service, but want to deploy it to a subset of users before migrating all users. Intelligent service routing lets you route a percentage of user requests to the new service and the rest of the request to a previous version; as you become more confident in the new service, you can route more traffic to it.
- Autoscaling. Knative can scale services up into the thousands of instances; it can also scale them down to zero - that is, no instances of the container at all - which is critical for supporting serverless applications.
Eventing
Knative queues and delivers those events to the appropriate containers, so there’s no need to write scripts or implement middleware for the functionality. Knative Event sources make it easier for developers to create connections to third-party event producers.
Reference
Formal
Take-away
Blog
What is Knative? K for Kubernetes + Native
http://vincentgaohj.github.io/Blog/2022/06/22/What-is-Knative-K-for-Kubernetes-Native/