Skip to content

Instantly share code, notes, and snippets.

@viniciusjssouza
Created June 28, 2019 15:19
Show Gist options
  • Select an option

  • Save viniciusjssouza/4e0bc176cde2df8d75a94647fca46d7d to your computer and use it in GitHub Desktop.

Select an option

Save viniciusjssouza/4e0bc176cde2df8d75a94647fca46d7d to your computer and use it in GitHub Desktop.
access the logs of a running container inside a POD
#/bin/bash
# Access the current logs of the provided POD
#
# Parameter 1: the app name, which should match the deployment name (<app name>-deployment) and the container name.
POD_NAME=$(kubectl get pods -n stock --no-headers -o custom-columns=":metadata.name" | grep -m1 "$1-deployment")
echo "Acessing pod $POD_NAME"
kubectl logs "$POD_NAME" -n stock -c "$1" --follow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment