Home > Software engineering >  run a shell script inside the pod
run a shell script inside the pod

Time:09-30

I am trying to write a single line command to run a shell script which is inside the pod

getting a shell for a running container:

kubectl exec -it test-pod -c test-container -- /bin/bash

directory in the container:

cd test/bin

script inside the bin:

./backup.sh

how do I write all this in a single command?

CodePudding user response:

Try:

kubectl exec -it test-pod -c test-container -- sh /full/path/to/the/backup.sh

CodePudding user response:

Try:

kubectl exec -it test-pod -c test-container -- /bin/bash -c "/path/to/backup-script.sh"

  • Related