k8s 容器数据拷贝

将本地文件拷贝到容器内

[root@k8s-master1 ~]# ll
total 16
-rwxr-xr-x. 1 root root  322 Jul  6 09:48 1.sh
-rw-------. 1 root root 1261 Nov 14  2019 anaconda-ks.cfg
drwxr-xr-x. 2 root root   22 Jul  4 09:27 hpa
drwxr-xr-x. 2 root root  227 Jul  2 15:32 metrics-server
-rw-r--r--. 1 root root  375 Jul  4 09:31 my-deploy.yaml
-rw-r--r--. 1 root root  356 Jul  6 09:48 temp
[root@k8s-master1 ~]# kubectl get pod
NAME                   READY   STATUS      RESTARTS   AGE
busybox                0/1     Completed   0          18d
web-5c987b8447-6b6bx   1/1     Running     0          3d20h
web-5c987b8447-jndbj   1/1     Running     0          2d4h
[root@k8s-master1 ~]# kubectl cp ./temp web-5c987b8447-6b6bx:/tmp
[root@k8s-master1 ~]# 

 

[root@k8s-master1 ~]# kubectl exec -it web-5c987b8447-6b6bx sh
# ls /tmp

 

你可能感兴趣的:(k8s 容器数据拷贝)