-
Does someone already created some script to restart all meshed pods (for example after version upgrade)? Thanks guys. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
kubectl get deploy \
-o custom-columns=NAME:.metadata.name,"ANNOTATIONS":".spec.template.metadata.annotations.linkerd\.io/inject" \
--no-headers | \
grep enabled | \
awk '{ print $1 }' | \
xargs kubectl rollout restart deploy |
Beta Was this translation helpful? Give feedback.
-
Actually, @grampelberg answer didn't cover pods that got injected by namespace annotation + has to be run for each namespace separately. I've crafted some one-liner that deletes all pods in the cluster that has a specific container, in that example edge-20.10.5, delayed by 5 seconds between each to make it safer. |
Beta Was this translation helpful? Give feedback.
Actually, @grampelberg answer didn't cover pods that got injected by namespace annotation + has to be run for each namespace separately.
I've crafted some one-liner that deletes all pods in the cluster that has a specific container, in that example edge-20.10.5, delayed by 5 seconds between each to make it safer.
kubectl get pod --all-namespaces -o=json | jq '.items[]|select(any( .spec.containers[]; .image=="ghcr.io/linkerd/proxy:edge-20.10.5"))|"\(.metadata.namespace) \(.metadata.name)"' | awk '{ system("sleep 5"); print $1,$2 }' | xargs -L1 bash -c 'kubectl delete pod -n $0 $1'