Skip to content

Instantly share code, notes, and snippets.

@fabio-filho
Last active December 22, 2022 18:44
Show Gist options
  • Save fabio-filho/deb5c7f2fb9c2939bab46fbe1a90a2e6 to your computer and use it in GitHub Desktop.
Save fabio-filho/deb5c7f2fb9c2939bab46fbe1a90a2e6 to your computer and use it in GitHub Desktop.
watch k8s pod logs
# usage: bash watch_pod_logs.sh "namespace" "pod_name (can be the full or partial name)" "container_name"
while [ : ]
do
pod_name=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -n $1 | grep $2 | tail -n 1)
echo "========================================================================================"
kubectl logs -n $1 $pod_name -c $3
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment