企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## pod拷贝到宿主机 ```shell $ kubectl cp busybox-79b94f5dd8-sjx7m:/etc/hosts ./hosts $ cat ./hosts # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 20.188.122.132 busybox-79b94f5dd8-sjx7m # Entries added by HostAliases. 192.168.31.100 todo.ecloud.com ``` ## 宿主机拷贝到pod ```shell $ kubectl cp /etc/hosts busybox-79b94f5dd8-sjx7m:/ $ kubectl exec busybox-79b94f5dd8-sjx7m -- cat /hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.31.103 k8s-master01 192.168.31.79 k8s-master02 192.168.31.95 k8s-node01 192.168.31.78 k8s-node02 192.168.31.253 k8s-node03 192.168.31.188 wwww.ecloud.com ```