Knative: Serverless Without Cloud Lock-in
Knative brings serverless capabilities to any Kubernetes cluster. Scale to zero, auto-scale on demand, event-driven workloads — all without AWS Lambda or Google Cloud Functions lock-in.
Two Components
- Knative Serving — request-driven auto-scaling, scale-to-zero
- Knative Eventing — event-driven architecture, CloudEvents
The Free API (CRDs)
Serving
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: my-api
spec:
template:
spec:
containers:
- image: my-api:v1
ports:
- containerPort: 8080
resources:
limits:
memory: 256Mi
metadata:
annotations:
autoscaling.knative.dev/minScale: "0"
autoscaling.knative.dev/maxScale: "100"
autoscaling.knative.dev/target: "50"
# Deploy
kn service create my-api --image my-api:v1 --port 8080
# Update with traffic split
kn service update my-api --image my-api:v2 --traffic @latest=10 --traffic my-api-v1=90
# List revisions
kn revision list
# Get URL
kn service describe my-api -o url
Eventing
apiVersion: sources.knative.dev/v1
kind: ApiServerSource
metadata:
name: pod-events
spec:
serviceAccountName: events-sa
mode: Resource
resources:
- apiVersion: v1
kind: Pod
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: event-handler
Real-World Use Case
A data processing company ran ML inference on Kubernetes. During off-hours, GPUs sat idle costing $2,000/month. Knative scale-to-zero cut costs to $400/month — pods spin up in seconds when requests arrive.
Quick Start
kubectl apply -f https://github.com/knative/serving/releases/latest/download/serving-crds.yaml
kubectl apply -f https://github.com/knative/serving/releases/latest/download/serving-core.yaml
Resources
Need automated data pipelines? Check out my tools on Apify or email spinov001@gmail.com for custom serverless solutions.
Top comments (0)