kubectl PVC-pod 매핑 확인

1 개요[ | ]

kubectl PVC-pod 매핑 확인
  • jq 필요
명령어
kubectl get pods -A -o=json | jq -c '.items[] | {namespace:.metadata.namespace, name:.metadata.name, claimName:.spec | select(has("volumes")).volumes[] | select(has("persistentVolumeClaim")).persistentVolumeClaim.claimName }'
실행예시
$ kubectl get pods -A -o=json | jq -c '.items[] | {namespace:.metadata.namespace, name:.metadata.name, claimName:.spec | select(has("volumes")).volumes[] | select(has("persistentVolumeClaim")).persistentVolumeClaim.claimName }'
{"namespace":"prod","name":"prod-db1-68024d7cf9-vnh1z","claimName":"prod-db1-pvc"}
{"namespace":"test","name":"test-db1-57913f6f8d-r0rhr","claimName":"test-db1-pvc"}

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}