Why Knative Matters
Knative brings serverless capabilities to Kubernetes. Deploy containers that automatically scale to zero when idle and scale up instantly on demand — no Lambda-style vendor lock-in.
Install Knative Serving
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
Deploy a Serverless Service
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: hello-world
spec:
template:
spec:
containers:
- image: ghcr.io/knative/helloworld-go:latest
ports:
- containerPort: 8080
env:
- name: TARGET
value: "World"
kubectl apply -f service.yaml
Key Features
- Scale to zero — pods terminate when no traffic, saving resources
- Auto-scaling — handles traffic spikes automatically with KPA or HPA
- Traffic splitting — canary deployments with percentage-based routing
- Revisions — every deployment creates an immutable revision
- Custom domains — map your own domains to services
Traffic Splitting for Canary Deploys
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: hello-world
spec:
template:
metadata:
name: hello-world-v2
spec:
containers:
- image: ghcr.io/knative/helloworld-go:latest
traffic:
- revisionName: hello-world-v1
percent: 80
- revisionName: hello-world-v2
percent: 20
Knative Eventing
Knative Eventing enables event-driven architectures:
apiVersion: sources.knative.dev/v1
kind: ApiServerSource
metadata:
name: k8s-events
spec:
serviceAccountName: events-sa
mode: Resource
resources:
- apiVersion: v1
kind: Event
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: event-display
Knative vs Traditional K8s Deployments
| Feature | K8s Deployment | Knative Service |
|---|---|---|
| Scale to zero | No | Yes |
| Auto-scaling | HPA only | Built-in KPA |
| Traffic split | Ingress rules | Native support |
| Revisions | Manual | Automatic |
| Cold start | N/A | ~1-3 seconds |
Resources
Need to scrape Kubernetes configs, cloud APIs, or infrastructure data at scale? Check out my data extraction tools on Apify or email spinov001@gmail.com for custom scraping solutions.
Top comments (0)