Created
February 14, 2017 11:06
-
-
Save bergman/f0c895e718868cc0566b52e2371e5d48 to your computer and use it in GitHub Desktop.
some useful kubectl customisations
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
# run like this: | |
# kubectl get nodes -o json | python nodes.py | |
import json | |
import sys | |
format = "%-45s %-12s %6s" | |
print format % ("NAME", "IP", "IMAGES") | |
for item in json.load(sys.stdin)["items"]: | |
print format % (item["metadata"]["name"], | |
item["status"]["addresses"][0]["address"], | |
sum([len(x["names"]) for x in item["status"]["images"]])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this could probably be done with jq...