Knative Serving — Serverless and Event-Driven Workloads on Kubernetes
Knative Serving brings request-driven autoscaling, revision management and a simple Service CRD to Kubernetes so developers can deploy containers as HTTP-accessible services that scale to zero.
Instalación lista para agent
Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.
npx -y tokrepo@latest install db3b0313-38e7-11f1-9bc6-00163e2b0d79 --target codexEjecutar después de confirmar el plan con dry-run.
What it is
Knative Serving is the serverless sub-project of Knative, a CNCF incubating project started at Google. It layers request-driven autoscaling and traffic-splitting on top of Kubernetes, so teams can focus on container images instead of wiring Deployments, HPAs, Services, and Ingresses together.
Knative introduces a simple Service CRD that owns Configurations, Revisions, and Routes. It scales workloads from zero to thousands of pods based on concurrency or requests per second.
How it saves time or tokens
Knative Serving removes the boilerplate of configuring Kubernetes Deployments, HorizontalPodAutoscalers, Services, and Ingresses for each workload. A single Service CRD replaces all four resources. Scale-to-zero means idle workloads consume no resources, reducing infrastructure costs. Traffic splitting across revisions enables canary and blue/green deployments without a separate tool.
How to use
- Install Knative Serving on an existing cluster:
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
kubectl apply -f https://github.com/knative/net-kourier/releases/latest/download/kourier.yaml
kubectl patch configmap/config-network -n knative-serving \
--type merge -p '{"data":{"ingress-class":"kourier.ingress.networking.knative.dev"}}'
- Deploy a service:
kn service create hello \
--image=ghcr.io/knative/helloworld-go:latest \
--port=8080
kn service list
- Split traffic between revisions for canary deployments:
kn service update hello --traffic hello-00001=80 --traffic hello-00002=20
Example
A Knative Service manifest with concurrency-based autoscaling:
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: api-backend
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/target: '100'
autoscaling.knative.dev/minScale: '0'
autoscaling.knative.dev/maxScale: '50'
spec:
containers:
- image: myregistry/api-backend:v2
ports:
- containerPort: 8080
resources:
requests:
cpu: 200m
memory: 256Mi
Related on TokRepo
- DevOps tools — More Kubernetes and deployment tools on TokRepo.
- Featured workflows — Discover curated infrastructure tools.
Common pitfalls
- Cold start latency when scaling from zero can be problematic for latency-sensitive APIs. Set minScale to 1 for critical services.
- Not configuring the networking layer (Kourier, Istio, or Contour) correctly causes service URLs to be unreachable. Verify the ingress configuration after installation.
- Knative's default concurrency target of 100 may not suit all workloads. Profile your application and adjust the autoscaling target accordingly.
Preguntas frecuentes
Knative Serving handles request-driven HTTP workloads with autoscaling and traffic management. Knative Eventing handles event-driven architectures with brokers, triggers, and event sources. They can be used independently or together.
Yes. When no requests arrive, Knative scales the workload down to zero pods. When a request comes in, the activator component holds it while a pod starts up. This saves resources for infrequently used services.
Knative supports Kourier (lightweight, recommended for most setups), Istio (full service mesh), and Contour as networking layers. Each provides different tradeoffs between simplicity and features.
Yes. Knative creates a new Revision for each configuration change. You can route 100% of traffic to the new revision (blue/green) or split traffic between revisions (canary) using the traffic configuration.
Yes. Knative is a CNCF incubating project with production deployments at Google Cloud Run, IBM Cloud Code Engine, and many enterprises. It has a stable API and regular releases.
Referencias (3)
- Knative GitHub— Knative Serving serverless platform for Kubernetes
- Knative Documentation— Knative autoscaling configuration
- CNCF Knative— CNCF project governance
Relacionados en TokRepo
Discusión
Activos relacionados
Apache OpenWhisk — Open Source Serverless Cloud Platform
Apache OpenWhisk is a serverless functions platform that lets you deploy event-driven code in any language without managing servers, with support for composable action sequences and rich trigger integrations.
Fission — Fast Serverless Functions on Kubernetes
Fission is an open-source serverless framework for Kubernetes that lets developers deploy functions in Python, Go, Node.js, and other languages with sub-second cold starts and no container builds required.
Nuclio — High-Performance Serverless Framework for Real-Time Data
Nuclio is a serverless framework optimized for real-time and data-intensive workloads, delivering sub-millisecond cold starts and high throughput on Kubernetes, Docker, or bare metal.
Modal — Serverless GPU Cloud for AI Workloads
Run GPU workloads in the cloud with Python decorators. Modal provides serverless A100/H100 GPUs for model inference, fine-tuning, and batch jobs with zero infrastructure.