Reputation: 830
I'm using Kubernetes on Digitalocean cloud platform
the deckorized laravel app is running right now
and i need to run php artisan optimize:clear
to all pods which are loading the app
how can i do that?
Edit:
I got the solution
First step connect to pod container
kubectl exec -it pod_name -- /bin/bash
then
php artisan optimize:clear
or
kubectl exec -it pod_name -- /bin/bash -c "php artisan route:clear"
Upvotes: 2
Views: 710
Reputation: 342
You can build a bash file like the below:
#!/bin/bash
PODS=$(kubectl get pods -n my-production | grep php-fpm | awk -F' *|/' '$2 == $3 && $4 == "Running"' | awk {'print $1'} | column -t )
for POD in $PODS
do
echo $POD
kubectl -n my-production exec $POD -c php -- php artisan optimize:clear
done
echo "Done!"
Upvotes: 2