-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kubectl get deployments #20009
Kubectl get deployments #20009
Conversation
LGTM General observation: UPDATEDREPLICAS is probably confusing |
Labelling this PR as size/M |
Please use How about REPLICAS (desired), CURRENT, UP_TO_DATE, and AVAILABLE. At some point, we should reconcile with RC and RS columns. |
GCE e2e test build/test passed for commit bff6e32e449f111890350ec477268d2a35c67931. |
RC columns are:
Fields that contain lists (containers, images, selector) make the output wide and hard to read, so I don't think we should just copy this. For instance, I don't think containers and selector are very important here. Existing label options should satisfy most of the use cases for the selector, and images (and their tags) are more important than the container names. I'd list the first image, appended with +N for the number of other containers, if any. |
See also #19775 |
If we use IMAGE(S), and REPLICAS, CURRENT, UP_TO_DATE, and AVAILABLE, it looks like this: $ kubectl get deployments nginx-deployment
NAME IMAGE(S) REPLICAS CURRENT UP_TO_DATE AVAILABLE AGE
nginx-deployment nginx(+2) 3 3 3 3 1s I think CURRENT, UP_TO_DATE, and AVAILABLE are a bit vague without "REPLICAS", but REPLICAS is too long. hpa uses PODS instead of REPLICAS in printer header. So how about: $ kubectl get deployments nginx-deployment
NAME IMAGE(S) DESIRED_PODS CURRENT_PODS UP_TO_DATE_PODS AVAILABLE_PODS AGE
nginx-deployment nginx(+2) 3 3 3 3 1s or we can use two-line header: $ kubectl get deployments nginx-deployment
NAME IMAGE(S) DESIRED CURRENT UP_TO_DATE AVAILABLE AGE
REPLICAS REPLICAS REPLICAS REPLICAS
nginx-deployment nginx(+2) 3 3 3 3 1s or we merge replicas together: $ kubectl get deployments nginx-deployment
NAME IMAGE(S) CURRENT/UP_TO_DATE/AVAILABLE/DESIRED_PODS AGE
nginx-deployment nginx(+2) 3/3/3/3 1s |
@janetkuo I would go with your first option, but without IMAGES. While it's true that the columns are vague at first, I think it's just a small learning curve that's okay to incur, especially if $ kubectl get deployments nginx-deployment
NAME DESIRED CURRENT UP_TO_DATE AVAILABLE AGE
nginx-deployment 3 3 3 3 1s
$ kubectl describe deployments nginx-deployment
Name: nginx-deployment
Desired replicas: 3
Current replicas: 3
Up to date replicas: 3
Available replicas: 3
... That way if someone doesn't understand the column names they can just run describe and pretty quickly realize what they mean. We also can update the deployment user guide to explain the columns. As for listing IMAGE(S):
I wrote out a similar case in #19775. |
I like the proposal from @ghodss. We can add images later, maybe under |
Note that status is a long-requested feature #7483. We should add status summaries to ReplicaSet as well at some point. |
One other suggestion - can we do $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ I personally think it would look much worse with underscores: $ docker ps
CONTAINER_ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ netstat uses spaces: $ netstat -anlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:33895 0.0.0.0:* LISTEN -
... Other examples usually make the columns more cryptic rather than resort to word separators: $ ps axu
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.3 46264 6156 ? Ss Jan24 0:02 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
root 2 0.0 0.0 0 0 ? S Jan24 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S Jan24 0:16 [ksoftirqd/0]
...
$ fleetctl list-unit-files
UNIT HASH DSTATE STATE TMACHINE
hello.service e55c0ae inactive inactive -
$ w
USER TTY FROM LOGIN@ IDLE WHAT
sam console - 13Jan16 11days -
sam s000 - 13Jan16 10:51 -bash
sam s001 - 13Jan16 - tmux I haven't found any command line tool that uses underscores as separators. tl;dr I think spaces are the best balance between readability and usability. |
@ghodss The reason I don't like spaces in column headers or contents is because that's unfriendly to column extraction (e.g., |
I also find the netstat output hard to read due to the single spaces between some columns (esp. Send-Q and "Local Address"). |
|
If you're extracting columns, there's a high likelihood you're doing some processing and would want to use --no-headers anyways. I would suggest starting with the friendlier version (single spaces) as convention and moving away if there are complaints. Also as I was thinking more about this case, up-to-date is often hyphenated in plan English, so maybe UP-TO-DATE is acceptable. |
bff6e32
to
abc9a75
Compare
@bgrant0607 Comments addressed, PTAL. $ kubectl get deployments nginx-deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
nginx-deployment 3 3 3 3 3m kubectl convention doc is updated too. |
Labelling this PR as size/S |
@@ -110,7 +110,7 @@ Updated: 8/27/2015 | |||
* However, affordances are made for simple parsing of `get` output | |||
* Only errors should be directed to stderr | |||
* `get` commands should output one row per resource, and one resource per row | |||
* Column titles and values should not contain spaces in order to facilitate commands that break lines into fields: cut, awk, etc. | |||
* Column titles and values should not contain spaces in order to facilitate commands that break lines into fields: cut, awk, etc. Instead, use `_` as the word separator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You use dash. :-)
Could you change this to dash and then also change CLUSTER_IP and EXTERNAL_IP to match the convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Mostly LG except for underscore vs. dash. |
abc9a75
to
07290ac
Compare
@bgrant0607 All comments addressed. PTAL. |
07290ac
to
fa25e29
Compare
GCE e2e test build/test passed for commit abc9a75121b98bf466453c042e70b1ebc29a723a. |
GCE e2e test build/test passed for commit 07290ac574a7f0bf5133026242015be16fc72f22. |
GCE e2e test build/test passed for commit fa25e29. |
LGTM |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit fa25e29. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
…ents Auto commit by PR queue bot
Print different
replicas
of deployments.cc @nikhiljindal @Kargakis @bgrant0607 @kubernetes/kubectl