Skip to content

Instantly share code, notes, and snippets.

@fmuyassarov
Last active January 15, 2024 07:51
Show Gist options
  • Save fmuyassarov/bf70dead1f2126b8ee8d88dd29c997c5 to your computer and use it in GitHub Desktop.
Save fmuyassarov/bf70dead1f2126b8ee8d88dd29c997c5 to your computer and use it in GitHub Desktop.
#!/bin/bash
ns=${NS:-default}
BLUE='\033[0;34m'
Color_Off='\033[0m'
for pod in $(kubectl -n $ns get pods | tr -s '\t' ' ' |
cut -d ' ' -f1 | grep -v ^NAME | tr -d '"'); do
for ctr in $(kubectl get -n $ns pod $pod -o json |
jq '.spec.containers[].name' | tr -d '"'); do
echo -e "* resources for ${BLUE}$pod:$ctr"
echo -e "${Color_Off}$(kubectl exec -n $ns -c $ctr $pod -- cat /proc/self/status |
grep _allowed_list | sed 's/^/ /g')"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment