Node CLI commands through kubectl exec pod_name --

200 Views Asked by At

I am trying to build a script, which would be running database queries on a pod, after loading node CLI. Manually, i run kubectl exec pod_name -- node test.js, and that would give me a CLI and I run my queries there. Is there a way I can add this step in an automation bash script?

Thanks!

I tried,

kubectl exec -it rethinkdb-pod -- node test.js; r.dbList()
kubectl exec -it rethinkdb-pod -- node test.js && r.dbList()
kubectl exec -it rethinkdb-pod -- node "test.js; r.dbList()"

I also tried to create a script and pass it on to the exec, but no luck there!

0

There are 0 best solutions below