Created
September 24, 2019 23:32
-
-
Save shcallaway/870508a76988bc3455196b2243286c1f to your computer and use it in GitHub Desktop.
List all resource and subresource types available in a Kubernetes cluster
This file contains hidden or 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/sh | |
| # Source: https://medium.com/@tannhauser.sphinx/bash-kubernetes-script-to-list-all-available-resources-subresources-c65a5c2c1173 | |
| _list=($(kubectl get --raw / |grep "^ \"/api"|sed 's/[",]//g')); | |
| for _api in ${_list[@]}; do | |
| _aruyo=$(kubectl get --raw ${_api} | jq .resources); | |
| if [ "x${_aruyo}" != "xnull" ]; then | |
| echo; | |
| echo "===${_api}==="; | |
| kubectl get --raw ${_api} | jq -r ".resources[].name"; | |
| fi; | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment