Skip to content

Instantly share code, notes, and snippets.

@wittawasw
Last active August 4, 2024 17:20
Show Gist options
  • Save wittawasw/6ce1fd3226fbc125015e44713fbabd99 to your computer and use it in GitHub Desktop.
Save wittawasw/6ce1fd3226fbc125015e44713fbabd99 to your computer and use it in GitHub Desktop.
function ks() {
kgpo | awk 'NR>1 {print $1}' | grep "$1" | while read -r POD_NAME; do
echo "$POD_NAME"
done
}
function krrm() {
kgpo | awk 'NR>1 {print $1}' | grep "$1" | while read -r POD_NAME; do
krm pod "$POD_NAME"
echo "Pod $POD_NAME restarted."
done
}
function ke() {
POD_NAME=$(kgpo | awk 'NR>1 {print $1}' | grep "$1" | head -n 1)
if [ -z "$2" ]; then
k exec -it "$POD_NAME" -- /bin/sh
else
shift
k exec -it "$POD_NAME" -- "$@"
fi
}
function kl() {
POD_NAME=$(kgpo | awk 'NR>1 {print $1}' | grep "$1" | head -n 1)
if [ "$2" = "-f" ]; then
k logs -f "$POD_NAME"
else
k logs "$POD_NAME"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment