在昨天的文章中,创建了 Disk + PV + PVC + POD 方案(https://www.cnblogs.com/lulight/p/17604441.html),那么如何进入到POD之中去查看文件呢? 如PVC Volume Mounts中文件?
使用 kubectl exec -it <your pod name> -- /bin/sh
注: /mnt/testazure 文件在POD的yaml文件中,预先指定。
使用echo写入txt文件
/mnt/testazure # echo "this is test file for AKS POD PVC,PC,DISK " > test1.txt /mnt/testazure # echo "this is test file for AKS POD PVC,PC,DISK " > test2.txt /mnt/testazure # echo "this is test file for AKS POD PVC,PC,DISK " > test3.txt /mnt/testazure # echo "this is test file for AKS POD PVC,PC,DISK " > test5.txt /mnt/testazure # echo "this is test file for AKS POD PVC,PC,DISK " > test4.txt /mnt/testazure # echo "this is test file for AKS POD PVC,PC,DISK " > test6.txt
命令为: kubectl exec -it mypod-pv-pvc-test -- df -h /mnt/testazure
显示文件夹的Size,使用占比等情况
Get a Shell to a Running Container : https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/
在不停机的情况下,调整永久性卷的大小: https://docs.azure.cn/zh-cn/aks/azure-disk-csi#resize-a-persistent-volume-without-downtime