Skip to content

Instantly share code, notes, and snippets.

@caruccio
Last active May 12, 2024 12:21
Show Gist options
  • Save caruccio/7df68326ea4b7523669a1991424d2cda to your computer and use it in GitHub Desktop.
Save caruccio/7df68326ea4b7523669a1991424d2cda to your computer and use it in GitHub Desktop.
Count all objects in a clusters
#!/bin/bash
kubectl api-resources --verbs=list -o name --namespaced=false | while read kind; do
echo -n "$kind: "
kubectl get --ignore-not-found -A $kind | wc -l
done 2>/dev/null
kubectl api-resources --verbs=list -o name --namespaced=true | while read kind; do
echo -n "$kind: "
kubectl get --ignore-not-found -A $kind | wc -l
done 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment