Skip to content

Instantly share code, notes, and snippets.

@countless-integers
Created January 6, 2017 12:23
Show Gist options
  • Save countless-integers/a7ed51700317b2809895d1eb5d71b9ed to your computer and use it in GitHub Desktop.
Save countless-integers/a7ed51700317b2809895d1eb5d71b9ed to your computer and use it in GitHub Desktop.
tail logs from kubernetes pod
#!/bin/bash
podId=$(kubectl get pod -o name | \
grep --color=never -o -E \
"\/.*$(echo $@ | tr '_ ' '.').*" \
)
podId=$(echo $podId | sed 's/ .*//g' | tr -d '/')
echo Showing logs from $podId
kubectl logs $podId --tail=20 -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment