Last active
April 28, 2020 19:21
-
-
Save elmiko/45ae0fe1a006e37c23581709711f2508 to your computer and use it in GitHub Desktop.
kubernetes command line incantations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% kubectl | |
# get all pods in cluster and show what node they are deployed on | |
kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.nodeName}{"\n"}' --all-namespaces | |
# get all pods on a node and show what namespace they are in | |
kubectl get pods -o=jsonpath='{range .items[?(@.spec.nodeName=="<Node ID>")]}{.metadata.name}{"\t"}{.metadata.namespace}{"\n"}' --all-namespaces | |
# get all machines and show their associated node | |
kubectl get machines -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.nodeRef.name}{"\n"}' | |
# get all machines and show their annotations | |
kubectl get machines -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.annotations}{"\n"}' | |
# show taints on all nodes | |
kubectl get nodes -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{range .spec.taints[*]} [{.effect}, {.key}]{"\n"}{end}{end}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment