Created
March 4, 2020 09:26
-
-
Save Laxman-SM/b3287d3a23507a83a0f985dea3da049c to your computer and use it in GitHub Desktop.
print kubernetes resources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/!bin/bash | |
print_kubernetes_resource() { | |
printf "\n\nGlobal\n======" | |
resource_count=$(expr $(kubectl api-resources --namespaced=false | wc -l) - 1) | |
resources=$(kubectl api-resources --namespaced=false | tail -n $resource_count | awk '{print $1}') | |
for resource in $resources; do | |
printf "\n\nChecking $resource...\n" | |
kubectl get $resource | |
done | |
printf "\n\nNamespaced\n==========" | |
resource_count=$(expr $(kubectl api-resources --namespaced | wc -l) - 1) | |
resources=$(kubectl api-resources --namespaced | tail -n $resource_count | awk '{print $1}') | |
for resource in $resources; do | |
printf "\n\nChecking $resource...\n" | |
kubectl get $resource --all-namespaces | |
done | |
} | |
print_kubernetes_resource |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment