I have a pod running python image as 199 user. My code app.py is place in /tmp/
directory, Now when I run copy command to replace the running app.py
then the command simply fails with file exists error.
Please try to use the --no-preserve=true
flag with kubectl cp
command. It will pass --no-same-owner
and --no-same-permissions
flags to the tar
utility while extracting the copied file in the container.
GNU tar
manual suggests to use --skip-old-files
or --overwrite
flag to tar --extract
command, to avoid error message you encountered, but to my knowledge, there is no way to add this optional argument to kubectl cp
.