Knative: Solution to Build Serverless and Event-Driven Applications on Kubernetes

Listen to this Post

Knative offers a powerful way to run serverless workloads on Kubernetes, bridging the gap between traditional FaaS platforms like AWS Lambda and self-managed Kubernetes clusters. While managed FaaS solutions provide simplicity, Knative gives you more control, making it ideal for environments where vendor lock-in or compliance restricts cloud-based serverless options.

Kushal Gangan’s article explores how Knative works and how to deploy event-driven applications on Kubernetes using this framework.

Read the full article here

You Should Know:

Setting Up Knative on Kubernetes

To deploy Knative, follow these steps:

1. Install Knative Serving:

kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.10.0/serving-crds.yaml
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.10.0/serving-core.yaml

2. Install a Networking Layer (Istio recommended):

kubectl apply -f https://github.com/knative/net-istio/releases/download/knative-v1.10.0/istio.yaml
kubectl apply -f https://github.com/knative/net-istio/releases/download/knative-v1.10.0/net-istio.yaml

3. Verify Installation:

kubectl get pods -n knative-serving

Deploying a Serverless Function

Create a Knative service (`service.yaml`):

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: hello-world
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
ports:
- containerPort: 8080
env:
- name: TARGET
value: "Knative"

Apply it:

kubectl apply -f service.yaml

Triggering Event-Driven Workflows

Use Knative Eventing to handle events:

kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.10.0/eventing-crds.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.10.0/eventing-core.yaml

Debugging Knative Issues

Common troubleshooting commands:

kubectl logs -n knative-serving <pod-name>
kubectl describe ksvc <service-name>

What Undercode Say

Knative provides flexibility for running serverless workloads on Kubernetes, but it demands deeper Kubernetes expertise compared to managed FaaS solutions. While tools like Google Cloud Run simplify Knative, self-managed deployments require mastery of Kubernetes internals.

For those in restricted environments, Knative is a viable alternative, but be prepared to handle its complexity. Strengthen your debugging skills with these Linux/Kubernetes commands:

kubectl get events --sort-by='.lastTimestamp'  Check cluster events 
journalctl -u kubelet -f  Monitor Kubelet logs 
kubectl top pods -A  Identify resource bottlenecks 

Expected Output:

A fully configured Knative environment running serverless applications on Kubernetes, with event-driven workflows and proper debugging tools in place.

Knative Official Docs
Kubernetes Troubleshooting Guide

References:

Reported By: Darryl Ruggles – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image