Skip to content

Instantly share code, notes, and snippets.

@leopoldodonnell
Created December 13, 2016 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leopoldodonnell/7ebe95f550b046a93a62b808693a2a2a to your computer and use it in GitHub Desktop.
Save leopoldodonnell/7ebe95f550b046a93a62b808693a2a2a to your computer and use it in GitHub Desktop.
Kubectl tricks etc
# Display all pods including IP info
kubectl get pods --all-namespaces --show-all -o wide
# Display all of the running containers
kubectl get pods -o jsonpath={.items[*].spec.containers[*].image} --all-namespaces --show-all |tr ' ' '\n' |sort -u
# Get the nodeport for a service - find a jsonpath way
servicename=`kubectl get svc some-service`
kubectl describe service $servicename |awk '$1 == "NodePort:" {sub(/\\/TCP/, "", $NF); print $NF}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment