Execute Command on Each Pod of a Kubernetes Deployment
KubernetesAnother very quick trick.
In this case, I want to setup the maintenance mode from Laravel on each pod in a Kubernetes cluster.
The idea is to list pods from a particular label, and execute command on each one with the following one liner command.
kubectl get po -l app.kubernetes.io/name=myapp -o name | xargs -I{} kubectl exec {} -- php artisan down