I am trying to copy a jar file to specific pod's container by executing below command.
kubectl cp local_policy.jar podname:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/security
.
I am getting below error.
rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\\"tar\\\": executable file not found in $PATH\"\n"
Please help.
Just install tar
binary in the container to/from which you want to copy files. This will allow the kubectl command to copy files from your local machine to the target container. On Amazon linux you can install it via yum
yum install tar
tar binary is necessary to run cp. It is in the help page of kubectl cp:
kubectl cp --help
Copy files and directories to and from containers.
Examples:
# !!!Important Note!!!
# Requires that the 'tar' binary is present in your container
# image. If 'tar' is not present, 'kubectl cp' will fail.