Serverless Kubernetes combines the flexibility of containers with the operational simplicity of serverless computing, abstracting away node management and scaling based on traffic.
Step 1 — Knative Serving
Knative Serving provides scale-to-zero capabilities, request-driven compute, and simplified deployments on top of standard Kubernetes.
service.yamlyaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: hello-world
namespace: default
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
env:
- name: TARGET
value: "Knative User"Step 2 — Node Auto-scaling with Karpenter
Karpenter is an open-source node provisioning project built for Kubernetes that rapidly provisions right-sized nodes in response to unschedulable pods.
Karpenter vs Cluster Autoscaler
- Group-less: Karpenter provisions raw compute resources directly, bypassing static Auto Scaling Groups.
- Speed: Karpenter can provision new nodes in seconds.
- Cost Efficiency: It bin-packs pods and selects the cheapest instance types available.