# If your pod container doesn't have bash in the path, you might need to replace `bash` with `/bin/bash/`, `/bin/sh` or `/bin/ash`. # Simple string from the command line - puts the literal text 'AAA' into a new file /tmp/test.txt echo 'AAA' > kubectl -n MyNamespace exec -ti $my_pod_id -c my-pod-container -- bash -c 'cat - > /tmp/test.txt' # Copy / inject a file from the local filesystem into a new file in the pod in the remote kubernetes cluster kubectl -n MyNamespace exec -i $my_pod_id -c my-pod-container -- bash -c 'cat - > /tmp/file.txt' </my/input/file.txt