{"action":"opened","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16700","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16700/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16700/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16700/events","html_url":"https://github.com/kubernetes/kubernetes/issues/16700","id":114716830,"number":16700,"title":"Add -N,--names-only flag to kubectl get","user":{"login":"mml","id":3115,"avatar_url":"https://avatars.githubusercontent.com/u/3115?v=3","gravatar_id":"","url":"https://api.github.com/users/mml","html_url":"https://github.com/mml","followers_url":"https://api.github.com/users/mml/followers","following_url":"https://api.github.com/users/mml/following{/other_user}","gists_url":"https://api.github.com/users/mml/gists{/gist_id}","starred_url":"https://api.github.com/users/mml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mml/subscriptions","organizations_url":"https://api.github.com/users/mml/orgs","repos_url":"https://api.github.com/users/mml/repos","events_url":"https://api.github.com/users/mml/events{/privacy}","received_events_url":"https://api.github.com/users/mml/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-03T00:37:18Z","updated_at":"2015-11-03T00:37:18Z","closed_at":null,"body":"Many admin operations are made easier by fetching a list of the names of things, e.g. into a shell variable.  See below for an example.  Rather than hacking up a template, asking for just the names should be a normal flag.\r\n<pre>% nodes=$(kubectl get nodes -lfoo=bar -otemplate --template='{{range .items}}{{.metadata.name}} {{end}}')\r\n% for node in $nodes; do\r\nfor> echo $node\r\nfor> done\r\n\r\n# Sanity check before beginning work.\r\n% echo $nodes | wc -w\r\n4\r\n\r\n% for node in $nodes; do \r\nfor> kubectl drain --force $node\r\nfor> maintenance_script $node\r\nfor> kubectl undrain $node\r\nfor> sleep 900\r\nfor> done\r\n</pre>"}}