使用kubectl cp将本地文件复制到密钥斗篷的k8s容器失败



这就是我对的赞扬

kubectl cp /Users/Documents/keycloak-deployment/import/realm-export-sdp.json sdp-steve/keycloak-7458697ddb-tbzp8:/tmp

我得到的错误信息如下:

rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:235: starting container process caused "exec: "tar": executable file not found in $PATH"
error: Internal error occurred: error executing command in container: read unix @->/var/run/docker.sock: read: connection reset by peer

有人知道如何处理这个错误吗?提前谢谢。

容器映像必须具有tar二进制文件才能运行kubectl cp子命令。结果,您得到以下错误:

"exec: "tar": executable file not found in $PATH

请参阅以下片段:

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.
#
# For advanced use cases, such as symlinks, wildcard expansion or
# file mode preservation, consider using 'kubectl exec'.

您可以查看此页面,了解为什么需要tar

相关内容

  • 没有找到相关文章

最新更新