[root@k8s-master ~]# kubectl get po
NAME                         READY   STATUS             RESTARTS           AGE
data-java-9bbf8c957-jp5dl    0/1     CrashLoopBackOff   9745 (4m28s ago)   34d
data-java-bc8f6fd78-8hplm    0/1     CrashLoopBackOff   9745 (86s ago)     34d
jenkins-65dc6fc9ff-9nvbk     1/1     Running            0                  6d
vue-login-5767c47fd5-8sq6s   1/1     Running            0                  34d
yarn-bgq8d                   1/1     Running            0                  57s

  需要将yarn-bgq8d 这个pod里面的nginx.conf ,拷贝到宿主机节点上。

[root@k8s-master ~]# kubectl exec  -ti  yarn-bgq8d   -n jenkins /bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@yarn-bgq8d:/home/jenkins/agent# ls
caches    remoting  workspace
root@yarn-bgq8d:/home/jenkins/agent# cd workspace/
root@yarn-bgq8d:/home/jenkins/agent/workspace# ls
app-front-pro  app-front-pro@tmp
root@yarn-bgq8d:/home/jenkins/agent/workspace# cd app-front-pro
root@yarn-bgq8d:/home/jenkins/agent/workspace/app-front-pro# ls
Dockerfile     README.md        components.d.ts  index.html  nginx.test.conf  plugins  src          tsconfig.node.json  unused.json
Dockerfile.test  auto-imports.d.ts  developsolution  nginx.conf  package.json      public   tsconfig.json  types              vite.config.ts

[root@k8s-master ~]# kubectl cp yarn-bgq8d:/home/jenkins/agent/workspace/app-front-pro/nginx.conf    nginx.conf

目标路径不能接路径/  ,必须是 文件名

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐