[英]how to inspect the content of persistent volume by kubernetes on azure cloud service
I have packed the software to a container.我已将软件打包到容器中。 I need to put the container to cluster by Azure Container Service.我需要通过 Azure 容器服务将容器放入集群。 The software have outputs of an directory /src/data/
, I want to access the content of the whole directory.该软件具有目录/src/data/
,我想访问整个目录的内容。
After searching, I have to solution.搜索后,我必须解决。
I need to access and manage my output directory on Azure cluster.我需要访问和管理 Azure 集群上的输出目录。 In other words, I need a savior.换句话说,我需要一个救世主。
As I've explained here , in general, if you can interact with the cluster using kubectl
, you can create a pod/container, mount the PVC inside, and use the container's tools to, eg, ls
the contents.正如我在这里解释的那样,通常,如果您可以使用kubectl
与集群kubectl
,您可以创建一个 pod/容器,将 PVC 安装在里面,并使用容器的工具来,例如, ls
的内容。 If you need more advanced editing tools, replace the container image busybox
with a custom one.如果您需要更高级的编辑工具,请将容器图像busybox
替换为自定义工具。
Create the inspector pod创建检查员窗格
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: pvc-inspector
spec:
containers:
- image: busybox
name: pvc-inspector
command: ["tail"]
args: ["-f", "/dev/null"]
volumeMounts:
- mountPath: /pvc
name: pvc-mount
volumes:
- name: pvc-mount
persistentVolumeClaim:
claimName: YOUR_CLAIM_NAME_HERE
EOF
Inspect the contents检查内容
kubectl exec -it pvc-inspector -- sh
$ ls /pvc
Clean Up清理
kubectl delete pod pvc-inspector
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.