Skip to content

Instantly share code, notes, and snippets.

@leoh0
Created February 22, 2019 02:56
Show Gist options
  • Select an option

  • Save leoh0/dc83cb34dce4cbec96954321a352079e to your computer and use it in GitHub Desktop.

Select an option

Save leoh0/dc83cb34dce4cbec96954321a352079e to your computer and use it in GitHub Desktop.
stern search & select label
function sss ()
{
pods=$(kubectl get pods --all-namespaces \
--no-headers --show-labels | \
sed '1d' | \
fzf -x -m -e +s --reverse --no-mouse \
--bind=left:page-up,right:page-down | \
awk '{print $1" "$7}');
if [[ $pods != "" ]]; then
namespace=${pods/ *};
label=${pods/* };
stern -t -n "$namespace" -l "$label";
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment