AlgoViz

Linkerd

medium 26 min

Linkerd is a service mesh for Kubernetes that aims to be small.

See it run

Joining the mesh, balancing, breaking, detecting, and allowing.

Operations

A pod joins

From an annotation to a certificate.

Step 1 of 5

New pod

KubernetesInjectorIdentityProxyAppwaiting

Kubernetes asks the injector about the new pod. It carries the annotation.

Step 1: New pod

def start(pod):    if pod.annotation("linkerd.io/inject") == "enabled":        pod.add(proxy)    key = proxy.make_key()    cert = identity.sign(key, pod.service_account_token)    redirect_tcp_through(proxy)
What it costs
One restart
Who does it
One proxy a pod

The injector works when a pod is created, so restart pods after adding the annotation.

In the real world

The same linkerd doing real jobs. Pick one and step through it.

One client, 900 calls a second, three pods.

Step 1 of 2

Without a mesh

Pod 1Pod 2Pod 3
plain90000

One hot pod

One HTTP/2 connection, so one pod gets everything.

Step 1: Without a mesh

Common mistakes

The bugs interviewers watch for, with the fix beside each.

  • Forgetting the certificate dates

    critical

    The default anchor and issuer end after a year, and then meshed calls fail.

    Wrong
    linkerd install | kubectl apply -f -# and no alert
    Right
    # own anchor, cert-manager for the# issuer, alerts at 60 and 30 days
  • Latency balancing without a breaker

    major

    A pod that fails quickly looks like the best one.

    Wrong
    annotations: {}
    Right
    balancer.linkerd.io/failure-accrual:  consecutive
  • Server-first protocol on a normal port

    major

    Detection waits ten seconds for the client to speak.

    Wrong
    port: 4222
    Right
    port: 4222appProtocol: linkerd.io/opaque
  • Retrying writes

    critical

    A payment can be made twice when an answer is lost.

    Wrong
    retry.linkerd.io/http: 5xx# on the whole Service
    Right
    # on a GET route onlyretry.linkerd.io/http: gateway-error
  • Reading encryption as permission

    major

    mTLS is on, but every caller is still allowed, also in plain text.

    Wrong
    # default policy
    Right
    config.linkerd.io/default-inbound-policy:  audit   # then stricter

Interview tips

  • How to explain it

    • A small proxy in each pod.
    • Out: balance, retry, break.
    • In: permit, limit.
  • Order of work

    • Metrics first.
    • Then breakers and timeouts.
    • Then audit, then deny.
  • Reach for it when

    • Small team on Kubernetes.
    • gRPC is uneven.
    • mTLS is required.
  • Before production

    • HA control plane.
    • Certificate alerts.
    • Edge or vendor build decided.