DEV Community

Alex Spinov
Alex Spinov

Posted on

Linkerd Has a Free API — The Lightweight Service Mesh for Kubernetes

Linkerd is the lightest service mesh for Kubernetes — 10x less resource usage than Istio. It provides automatic mTLS, observability, and reliability features with minimal complexity.

Free, open source, CNCF graduated. The first service mesh, invented at Buoyant.

Why Use Linkerd?

  • Ultra-lightweight — ~10MB per proxy, minimal CPU/memory overhead
  • Simple — installs in 60 seconds, no complex config
  • Automatic mTLS — zero-config mutual TLS between all services
  • Golden metrics — success rate, latency, throughput per service
  • Retries & timeouts — automatic retry on failure

Quick Setup

1. Install

curl --proto '=https' -sL https://run.linkerd.io/install | sh
linkerd install --crds | kubectl apply -f -
linkerd install | kubectl apply -f -
linkerd check
Enter fullscreen mode Exit fullscreen mode

2. Inject Sidecar

# Inject into existing deployment
kubectl get deploy my-app -o yaml | linkerd inject - | kubectl apply -f -

# Or annotate namespace for auto-injection
kubectl annotate namespace default linkerd.io/inject=enabled
Enter fullscreen mode Exit fullscreen mode

3. Dashboard

linkerd viz install | kubectl apply -f -
linkerd viz dashboard &
Enter fullscreen mode Exit fullscreen mode

4. Check Service Metrics

# Per-service golden metrics
linkerd viz stat deploy -n default
# Shows: SUCCESS, RPS, LATENCY_P50, LATENCY_P95, LATENCY_P99

# Top routes by traffic
linkerd viz routes deploy/my-app

# Live traffic
linkerd viz tap deploy/my-app

# As JSON
linkerd viz stat deploy -o json | jq '.[] | {name: .resource, success_rate: .successRate, rps: .rps, p99_latency: .latencyMsP99}'
Enter fullscreen mode Exit fullscreen mode

5. Traffic Split (Canary)

kubectl apply -f - <<EOF
apiVersion: split.smi-spec.io/v1alpha1
kind: TrafficSplit
metadata:
  name: my-app-split
spec:
  service: my-app
  backends:
  - service: my-app-v1
    weight: 900
  - service: my-app-v2
    weight: 100
EOF
Enter fullscreen mode Exit fullscreen mode

6. Service Profiles (Per-Route Metrics)

# Auto-generate from OpenAPI spec
linkerd viz profile --open-api swagger.json my-app | kubectl apply -f -

# Check per-route metrics
linkerd viz routes deploy/my-app -o json | jq
Enter fullscreen mode Exit fullscreen mode

Python Example

import subprocess
import json

def linkerd_stats():
    result = subprocess.run(
        ["linkerd", "viz", "stat", "deploy", "-n", "default", "-o", "json"],
        capture_output=True, text=True)
    stats = json.loads(result.stdout)
    for s in stats:
        print(f"{s['resource']} | Success: {s['successRate']} | RPS: {s['rps']} | P99: {s['latencyMsP99']}ms")

linkerd_stats()
Enter fullscreen mode Exit fullscreen mode

Key CLI Commands

Command Description
linkerd viz stat Service metrics
linkerd viz routes Per-route metrics
linkerd viz tap Live traffic
linkerd viz top Top traffic
linkerd check Health check
linkerd inject Add sidecar proxy
linkerd viz dashboard Open dashboard

Linkerd vs Istio

Feature Linkerd Istio
Proxy Rust (linkerd2-proxy) C++ (Envoy)
Memory per pod ~10MB ~50MB
Complexity Simple Complex
mTLS Auto Auto
L7 protocols HTTP HTTP, gRPC, TCP, etc

Need custom data extraction or scraping solution? I build production-grade scrapers for any website. Email: Spinov001@gmail.com | My Apify Actors

Top comments (0)