Skip to content

Instantly share code, notes, and snippets.

@whitlockjc
Last active February 13, 2017 18:40
Show Gist options
  • Save whitlockjc/1e6c03e36189985636e079c8e7831a2f to your computer and use it in GitHub Desktop.
Save whitlockjc/1e6c03e36189985636e079c8e7831a2f to your computer and use it in GitHub Desktop.
Useful kubectl commands

Useful kubectl commands not in the kubectl Cheat Sheet:

List all nodes and their external IP

kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.addresses[?(@.type=="ExternalIP")].address}{"\n"}{end}'

List all running Pods and their IP

kubectl get pods --all-namespaces -o jsonpath='{range .items[?(@.status.phase=="Running")]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment