Skip to content

Linkerd: namespace annotated, but no proxy in the pod

Linkerdtested on Linkerd edge-26.11.2

The Linkerd proxy gets into the pod via a webhook – at creation time. If you annotate the namespace with linkerd.io/inject=enabled only after the deployment, the running pods have no proxy. The app keeps working, but it is not in the mesh.

Symptom

kubectl -n tag16 get pods -o custom-columns=NAME:.metadata.name,\
PROXY:.metadata.annotations.linkerd\\.io/proxy-version
NAME                        PROXY
helper-79d57fbbbb-mqhpg     <none>
last-78895758f9-52xd7       <none>
notes-api-5bc98b7fb-n4s5j   <none>
postgres-0                  <none>
web-7d94ccc84d-qjrst        <none>

The linkerd.io/proxy-version annotation is missing on every pod. linkerd viz stat finds no traffic because no proxy delivers metrics.

Diagnosis

linkerd check with --proxy and the namespace checks the data plane. --wait 30s matters: without it, the check waits up to five minutes for proxies to show up.

linkerd check --proxy -n tag16 --wait 30s 2>&1 | grep -A2 'proxies are ready'
× data plane proxies are ready
    no "linkerd-proxy" containers found in the "tag16" namespace
    see https://linkerd.io/2/checks/#l5d-data-plane-ready for hints

Causes

OrderNamespace annotated after the deployment

The webhook only changes new pods. Running pods stay as they are until they are restarted.

kubectl annotate namespace notes linkerd.io/inject=enabled
kubectl -n notes get pods
namespace/notes annotated
NAME                         READY   STATUS    RESTARTS   AGE
helper-564786ddcd-2dxzp      1/1     Running   0          3h50m

ExclusionPod annotation linkerd.io/inject=disabled

The annotation on the pod template wins over the one on the namespace. Pods excluded this way run 1/1.

kubectl -n tag02 patch deploy ohne -p \
  '{"spec":{"template":{"metadata":{"annotations":{"linkerd.io/inject":"disabled"}}}}}'
kubectl -n tag02 get pods -l app=ohne
NAME                  READY   STATUS    RESTARTS   AGE
ohne-58b54f56-fs5bd   1/1     Running   0          15s

Fix

Restart the workloads so the webhook creates the pods anew. Afterwards they show 2/2: app plus proxy.
kubectl -n tag16 rollout restart deploy
kubectl -n tag16 rollout restart statefulset/postgres
kubectl -n tag16 rollout status statefulset/postgres --timeout=180s
kubectl -n tag16 get pods
NAME                         READY   STATUS       RESTARTS      AGE
helper-5c9445c87c-khfww      2/2     Running      0             53s
last-6ddfdfcc46-8cpmp        2/2     Running      0             53s
postgres-0                   2/2     Running      0             51s
web-6df978d4f-mhgj5          2/2     Running      0             52s
▶
Break it yourself and find it – free
Linkerd hands-on, day 16: build in eight typical mesh faults, find them with linkerd check and diagnostics, and fix them.
Go to day 16 →

FAQ

Why is everything 403 right after the restart?

With the proxy, the default policy from the namespace annotation applies too. If it is deny and there are no Servers and rules, the proxy rejects every request.

Does the proxy count as a container even though it is an init container?

Yes. As a native sidecar it keeps running and shows up in READY as the second container.

Related error patterns

More