Skip to content

Rollout restart all meshed pods #5135

Answered by shaikatz
shaikatz asked this question in Q&A
Discussion options

You must be logged in to vote

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'

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@shaikatz
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by shaikatz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants