Skip to content

Instantly share code, notes, and snippets.

@leopoldodonnell
Created December 13, 2016 13:59
Embed
What would you like to do?
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