本地文件传输到 Kubernetes 持久卷?
Local files transfered to a Kubernentes Persistent Volume?
我对 Kubernetes 非常陌生(而且这不是我的领域),但我被要求能够执行此实践。
问题是我需要在容器化 pod 中安装 Handbrake 转换器,并在 GKE 集群上安装持久卷:
- 3 个节点。
- 节点版本 1.8.1-gke.1
- 节点图片Ubuntu
到目前为止一切都很好,但现在我无法从我的本地计算机将文件夹上传到该 PV。
我试过的是到节点的 ssh 连接,然后是 sudo docker exec -ti containerId bash
,但我刚得到 rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\"bash\\": executable file not found in $PATH\"\n"
。
提前致谢。
要将本地文件传输到 kubernetes pod,请使用 kubectl cp
:
kubectl cp /root/my-local-file my-pod:/root/remote-filename
或
kubectl cp /root/my-local-file my-namepace/my-pod:/root/remote-filename -c my-container
名称空间可以省略(您将获得默认值),容器可以省略(您将获得 pod 中的第一个)。
对于 SSH'ing,您还需要通过 kubectl:
kubectl exec -it <podname> -- /bin/sh
我对 Kubernetes 非常陌生(而且这不是我的领域),但我被要求能够执行此实践。
问题是我需要在容器化 pod 中安装 Handbrake 转换器,并在 GKE 集群上安装持久卷:
- 3 个节点。
- 节点版本 1.8.1-gke.1
- 节点图片Ubuntu
到目前为止一切都很好,但现在我无法从我的本地计算机将文件夹上传到该 PV。
我试过的是到节点的 ssh 连接,然后是 sudo docker exec -ti containerId bash
,但我刚得到 rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\"bash\\": executable file not found in $PATH\"\n"
。
提前致谢。
要将本地文件传输到 kubernetes pod,请使用 kubectl cp
:
kubectl cp /root/my-local-file my-pod:/root/remote-filename
或
kubectl cp /root/my-local-file my-namepace/my-pod:/root/remote-filename -c my-container
名称空间可以省略(您将获得默认值),容器可以省略(您将获得 pod 中的第一个)。
对于 SSH'ing,您还需要通过 kubectl:
kubectl exec -it <podname> -- /bin/sh