Skip to content

Instantly share code, notes, and snippets.

View lbbedendo's full-sized avatar

Leonardo Barbieri Bedendo lbbedendo

View GitHub Profile
@lbbedendo
lbbedendo / kubedf.sh
Created January 24, 2022 14:49 — forked from redmcg/kubedf
Bash script to show k8s PVC usage
#!/usr/bin/env bash
function getNodes() {
kubectl get --raw=/api/v1/nodes | jq -r '.items[].metadata.name'
}
function getPVCs() {
jq -s '[flatten | .[].pods[].volume[]? | select(has("pvcRef")) | '\
'{name: .pvcRef.name, capacityBytes, usedBytes, availableBytes, '\
'percentageUsed: (.usedBytes / .capacityBytes * 100)}] | sort_by(.name)'