I have a Kubernetes Cluster where the same application is running a few times but with different namespaces. Imagine
ns=app1 name=app1
ns=app2 name=app2
ns=app3 name=app3
[...]
ns=app99 name=app99
Now I need to execute a cronjob every 10 minutes in all of those Pods. The path is the same everytime.
Is there a 'best way' to achieve this?
I was thinking of a kubectl image running as 'CronJob' kind and something like this:
kubectl get pods -A -o=custom-columns='DATA:spec.containers[?(@.image=="registry.local/app-v1")].image' | xargs -i kubectl exec {} /usr/bin/scrub.sh
but I am pretty sure this is not the right way to go about this.