rwx 监控中的 Kubernetes pvc
Kubernetes pvc in rwx monitoring
我在 RWX 中有一个 PVC。
2 pods 使用此 PVC。
我想知道哪个 pods 询问 PVC 的音量以及何时。我该如何管理?
据我所知,没有直接的方法可以确定哪个 pod 使用了 PVC
要获取该信息,可能的解决方法是通过 grep 遍历相应 pvc 的所有 pods:
Ex:
- To display all the pods and their respective pvcs:
kubectl get pods -o jsonpath='{"POD"}{"\t"}{"PVC Name"}{"\n"}{range .items[*]}{.metadata.name}{"\t"}{range .spec.volumes[*]}{.persistentVolumeClaim.claimName}{"\t"}{end}{"\n"}{end}'
POD PVC Name
web1-0 www1-web1-0
web16-0 www16-web16-0
- To get information about a particular PVC (in this case:www16-web16-0 ) Using grep :
kubectl get pods -o jsonpath='{"POD"}{"\t"}{"PVC Name"}{"\n"}{range .items[*]}{.metadata.name}{"\t"}{range .spec.volumes[*]}{.persistentVolumeClaim.claimName}{"\t"}{end}{"\n"}{end}' | grep 'POD\|www16-web16-0'
POD PVC Name
web16-0 www16-web16-0
我在 RWX 中有一个 PVC。 2 pods 使用此 PVC。 我想知道哪个 pods 询问 PVC 的音量以及何时。我该如何管理?
据我所知,没有直接的方法可以确定哪个 pod 使用了 PVC 要获取该信息,可能的解决方法是通过 grep 遍历相应 pvc 的所有 pods:
Ex:
- To display all the pods and their respective pvcs:
kubectl get pods -o jsonpath='{"POD"}{"\t"}{"PVC Name"}{"\n"}{range .items[*]}{.metadata.name}{"\t"}{range .spec.volumes[*]}{.persistentVolumeClaim.claimName}{"\t"}{end}{"\n"}{end}'
POD PVC Name
web1-0 www1-web1-0
web16-0 www16-web16-0
- To get information about a particular PVC (in this case:www16-web16-0 ) Using grep :
kubectl get pods -o jsonpath='{"POD"}{"\t"}{"PVC Name"}{"\n"}{range .items[*]}{.metadata.name}{"\t"}{range .spec.volumes[*]}{.persistentVolumeClaim.claimName}{"\t"}{end}{"\n"}{end}' | grep 'POD\|www16-web16-0'
POD PVC Name
web16-0 www16-web16-0