直接拷贝会报错如下:
error: cannot exec into a container in a completed pod; current phase is Succeeded
解决:
1、用该容器的镜像创建一个新容器
kubectl run sync-demo --image=ccr.ccs.tencentyun.com/zhubaoe/marx:jenkins-marx-sync_stock_record-test-1-2982d99 --restart=Never -n dev --command -- sleep 3600
2、然后拷贝
kubectl cp -n dev sync-demo:/biz-code/sync_stock_record ./sync_stock_record