Skip to content

Instantly share code, notes, and snippets.

@rsperl
Last active July 25, 2022 13:12
Show Gist options
  • Select an option

  • Save rsperl/fb90479874f5fd70edd543650358a313 to your computer and use it in GitHub Desktop.

Select an option

Save rsperl/fb90479874f5fd70edd543650358a313 to your computer and use it in GitHub Desktop.
kubectl commands #k8s #snippet
# Get logs for all pods with a given label
kubectl logs -f -l app=my-app-label
# Get pod labels
kubectl get pods --show-labels
# ^^^ can be messy, so if your app label is the name of the deployment,
# just list the deployments
kubectl get deployments
# and then get logs for that app=deployment
kubectl logs -f -l app=my-deployment
########
# see also https://kubernetes.io/docs/reference/kubectl/cheatsheet/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment