What is Knative

Uncategorized

Knative is an open-source platform that extends Kubernetes to provide a serverless, event-driven, and autoscaling environment for running containerized applications. It was originally created by Google and is now governed by the CNCF (Cloud Native Computing Foundation).


What is Knative?

  • Knative adds a “serverless” layer on top of Kubernetes.
  • It enables you to run your containerized workloads only when they’re needed, scaling them up or down (even to zero) automatically, in response to events or HTTP traffic.
  • Designed to make deploying, running, and managing microservices and serverless functions easier, faster, and more resource-efficient.

Key Features

1. Serverless Workloads on Kubernetes

  • Automatically scales apps up or down (even to zero) based on demand.
  • No need to manage underlying servers or worry about idle resources.

2. Event-driven Applications

  • Easily connect to event sources (Kafka, CloudEvents, etc.) and trigger workloads in response.

3. Simplified Deployment

  • Simple, declarative YAML to deploy stateless services.
  • Handles networking, routing, and traffic splitting for blue/green and canary deployments.

4. Autoscaling

  • Supports HTTP-based scaling and concurrency-based scaling.
  • Great for unpredictable or bursty workloads.

5. Integration with CI/CD

  • Works with existing Kubernetes tools, pipelines, and other cloud-native technologies.

Core Components

  1. Knative Serving
    • Deploy and manage serverless, stateless services.
    • Supports autoscaling, revision tracking, and traffic splitting.
    • Each deployment creates a “Revision” (version) for easy rollback/rollforward.
  2. Knative Eventing
    • Build event-driven apps by connecting various event sources to services.
    • Standardizes event formats and delivery.

Knative in MLOps and ML Serving

  • Model Inference: Run ML model servers (like KFServing/KServe) that scale to zero when idle and auto-scale under load.
  • On-demand workloads: Useful for data preprocessing, batch jobs, or ad-hoc inference.

Example: Deploying a Knative Service

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: helloworld
spec:
  template:
    spec:
      containers:
        - image: gcr.io/knative-samples/helloworld-go
  • Deploy with: kubectl apply -f service.yaml

When to Use Knative?

  • You want to minimize cloud costs by running workloads only when needed.
  • You need auto-scaling for unpredictable, spiky, or infrequent workloads.
  • You want to build event-driven architectures on Kubernetes.
  • You’re building microservices that benefit from easy versioning and traffic management.

Knative vs. Other Tools

FeatureKnativeK8s DeploymentsAWS Lambda / GCP Cloud Functions
PlatformKubernetesKubernetesVendor Cloud Only
Scale to ZeroYesNoYes
Event-DrivenYes (via Eventing)NoYes
Traffic SplitYesNoYes
Language SupportAny (containerized)AnyLimited

Summary

Knative brings the benefits of serverless—autoscaling, event-driven execution, simple deployment—to any Kubernetes cluster, making it easier to run cost-efficient, scalable, and production-grade microservices or ML inference endpoints.


Leave a Reply

Your email address will not be published. Required fields are marked *