将主机上的文件拷贝到pod的容器中

官网文档

https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#cp

例如将主机上的index.html文件拷贝到pod容器中替换nginx首页显示


kubectl cp ./index.html -n test test-pod:/usr/share/nginx/html/

将pod容器中的index.html文件拷贝到主机目录上

kubectl cp nginx-pod:usr/share/nginx/html/index.html -n test /usr/local/resourece_yaml/index.html

posted @ 2022-10-28 12:02  弩哥++  阅读(244)  评论(0)    收藏  举报