如何查看附加到 pod 中容器的卷并向其中写入一些数据

Wit*_*pps 5 containers volume kubernetes kubectl kubernetes-pod

我想将一些数据写入卷中,即驻留在该卷中的目录之一,我可以执行 pod,但我不知道如何检查附加卷并向其写入数据。

我可以使用以下命令找到卷和安装点:

kubectl describe pods pod-name
Run Code Online (Sandbox Code Playgroud)

Kri*_*sia 5

您可以使用其输出kubectl describe podMounts每个容器的spec.

文档中的一个示例:

Mounts:
  /var/run/secrets/kubernetes.io/serviceaccount from default-token-5kdvl (ro)`
Run Code Online (Sandbox Code Playgroud)

然后,您可以exec使用 进入 podkubectl execcd进入要写入数据的目录。

另一种选择是使用命令,您可以在此处kubectl copy阅读我的相关答案。