Useful Bosh Oneliner to restart something on a bunch of TKGi nodes.

Robert Kloosterhuis, 2 march 2021

Found myself is a situation where I had to restart fluentd on every VM in a 130-node (!) TKGi(PKS) Kubernetes cluster.

Fluentd is managed through Monit, and you can run a command through the Bosh ssh command. In this case: sudo monit restart fluentd

So one of the customer admins that is way more fluent in bash that me, made this.

bosh -e <your bosh env> -d service-instance_e30c8cc7-ada0-4e70-9e72-455682749aaa vms | \
awk '{print "bosh -e <your bosh env> -d service-instance_e30c8cc7-ada0-4e70-9e72-455682749aaa ssh "$1" -c \"sudo monit restart fluentd\""}' \
> start-fluentd.sh

And then simply check and run start-fluentd.sh

 

 


Leave a Reply