该
kubectl cp命令将文件复制到Pod中的单个容器中。要轻松地将文件复制到多个容器中,可以使用以下shell脚本。
for pod in `kubectl get pods -o=name | grep wordpress | sed "s/^.{4}//"`; do echo "copying to $pod"; kubectl cp file.txt $pod:/; done要么
for pod in `kubectl get pods -o=name | grep wordpress | sed "s/^.{4}//"`do echo "copying file to $pod" kubectl cp file.txt $pod:/done这两个脚本是相同的,单行还是多行。



