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

Print container statuses in `kubectl get pods` #7116

Merged
merged 1 commit into from Apr 22, 2015

Conversation

Projects
None yet
6 participants
@yujuhong
Contributor

yujuhong commented Apr 21, 2015

kubectl get pod already prints one container per line. This change fills in
the status for each container listed. This aims to help users quickly identify
unhealthy pods (e.g. in a crash loop) at a glance.

  • The first row of every pod would display the pod information and status
  • Each row of the subsequent rows corresponds to a container in that pod:
    • STATUS refers to the container status (Running, Waiting, Terminated).
    • CREATED refers to the elapsed time since the last start time of the
      container.
    • MESSAGE is a string which explains the last termination reason, and/or
      the reason behind the waiting status.

@googlebot googlebot added the cla: yes label Apr 21, 2015

@yujuhong

This comment has been minimized.

Show comment
Hide comment
@yujuhong

yujuhong Apr 21, 2015

Contributor

An example:

POD       IP            CONTAINER(S)   IMAGE(S)           HOST                  LABELS    STATUS    CREATED     MESSAGE
crash     172.17.1.65                                     127.0.0.1/127.0.0.1   <none>    Running   2 minutes   
                        foo            ubuntu:14.04                                       Running   7 seconds   reason for last termination
foo       172.17.1.66                                     127.0.0.1/127.0.0.1   <none>    Pending   2 minutes   
                        bar1           kubernetes/pause                                   Running   2 minutes   
                        bar2           dummyimage                                         Waiting               Image: dummyimage is not ready on the node

I am unsure the multi-use of the "MESSAGE" field, so suggestions are welcome.

/cc @dchen1107 @vmarmol @smarterclayton

Contributor

yujuhong commented Apr 21, 2015

An example:

POD       IP            CONTAINER(S)   IMAGE(S)           HOST                  LABELS    STATUS    CREATED     MESSAGE
crash     172.17.1.65                                     127.0.0.1/127.0.0.1   <none>    Running   2 minutes   
                        foo            ubuntu:14.04                                       Running   7 seconds   reason for last termination
foo       172.17.1.66                                     127.0.0.1/127.0.0.1   <none>    Pending   2 minutes   
                        bar1           kubernetes/pause                                   Running   2 minutes   
                        bar2           dummyimage                                         Waiting               Image: dummyimage is not ready on the node

I am unsure the multi-use of the "MESSAGE" field, so suggestions are welcome.

/cc @dchen1107 @vmarmol @smarterclayton

Show outdated Hide outdated pkg/kubectl/resource_printer.go
if state.Waiting != nil {
return "Waiting", "", state.Waiting.Reason, nil
} else if state.Running != nil {
return "Running", translateTimestamp(state.Running.StartedAt), message, nil

This comment has been minimized.

@vmarmol

vmarmol Apr 21, 2015

Contributor

lets do the message here since we only use it for Running.

Can we also add a prefix, something like: "last terminated due to: %s" to make it clear what it is? The others it seems pretty clean what the message is I think.

@vmarmol

vmarmol Apr 21, 2015

Contributor

lets do the message here since we only use it for Running.

Can we also add a prefix, something like: "last terminated due to: %s" to make it clear what it is? The others it seems pretty clean what the message is I think.

This comment has been minimized.

@yujuhong

yujuhong Apr 21, 2015

Contributor

SG. Will do that if we all agree with reusing this field for different purposes :)

@yujuhong

yujuhong Apr 21, 2015

Contributor

SG. Will do that if we all agree with reusing this field for different purposes :)

This comment has been minimized.

@yujuhong

yujuhong Apr 21, 2015

Contributor

Done!

@yujuhong

yujuhong Apr 21, 2015

Contributor

Done!

@vmarmol vmarmol self-assigned this Apr 21, 2015

@vmarmol

This comment has been minimized.

Show comment
Hide comment
@vmarmol

vmarmol Apr 21, 2015

Contributor

This looks good!

Contributor

vmarmol commented Apr 21, 2015

This looks good!

@dchen1107

This comment has been minimized.

Show comment
Hide comment
@dchen1107

dchen1107 Apr 21, 2015

Member

I am fine with the output. @smarterclayton, how do you think about reusing MESSAGE column here since you guys are the first consumers of this kind of information?

Member

dchen1107 commented Apr 21, 2015

I am fine with the output. @smarterclayton, how do you think about reusing MESSAGE column here since you guys are the first consumers of this kind of information?

Show outdated Hide outdated pkg/kubectl/resource_printer.go
message = status.LastTerminationState.Termination.Reason
}
state := &status.State
if state.Waiting != nil {

This comment has been minimized.

@dchen1107

dchen1107 Apr 21, 2015

Member

If a container is killed, and now it is waiting due to pulling image. In this case, we lost previous terminated reason, right? I think I am ok with this, just want to point it out.

@dchen1107

dchen1107 Apr 21, 2015

Member

If a container is killed, and now it is waiting due to pulling image. In this case, we lost previous terminated reason, right? I think I am ok with this, just want to point it out.

This comment has been minimized.

@yujuhong

yujuhong Apr 21, 2015

Contributor

Yes, the intention was to expose information relevant to the last non-running status.

Alternatively, I can expose the last termination message for all three statuses, assuming user who is curious about the waiting status would simply run kubectl describe pod. We get uniformity in this approach, so perhaps it's worth doing.

@yujuhong

yujuhong Apr 21, 2015

Contributor

Yes, the intention was to expose information relevant to the last non-running status.

Alternatively, I can expose the last termination message for all three statuses, assuming user who is curious about the waiting status would simply run kubectl describe pod. We get uniformity in this approach, so perhaps it's worth doing.

Print container statuses in `kubectl get pods`
`kubectl get pod` already prints one container per line. This change fills in
the status for each container listed. This aims to help users quickly identify
unhealthy pods (e.g. in a crash loop) at a glance.

 - The first row of every pod would display the pod information and status
 - Each row of the subsequent rows corresponds to a container in that pod:
    * STATUS refers to the container status (Running, Waiting, Terminated).
    * CREATED refers to the elapsed time since the last start time of the
      container.
    * MESSAGE is a string which explains the last termination reason, and/or
      the reason behind the waiting status.
@smarterclayton

This comment has been minimized.

Show comment
Hide comment
@smarterclayton

smarterclayton Apr 21, 2015

Contributor

No concerns on my part, other than the general width of possible messages. I think the folks who hit this problem would have it solved by what you propose.

On Apr 21, 2015, at 3:06 PM, Dawn Chen notifications@github.com wrote:

I am fine with the output. @smarterclayton, how do you think about reusing MESSAGE column here since you guys are the first consumers of this kind of information?


Reply to this email directly or view it on GitHub.

Contributor

smarterclayton commented Apr 21, 2015

No concerns on my part, other than the general width of possible messages. I think the folks who hit this problem would have it solved by what you propose.

On Apr 21, 2015, at 3:06 PM, Dawn Chen notifications@github.com wrote:

I am fine with the output. @smarterclayton, how do you think about reusing MESSAGE column here since you guys are the first consumers of this kind of information?


Reply to this email directly or view it on GitHub.

@vmarmol

This comment has been minimized.

Show comment
Hide comment
@vmarmol

vmarmol Apr 22, 2015

Contributor

LGTM, merging since there is consensus and the build is green. Thanks @yujuhong!

Contributor

vmarmol commented Apr 22, 2015

LGTM, merging since there is consensus and the build is green. Thanks @yujuhong!

vmarmol added a commit that referenced this pull request Apr 22, 2015

Merge pull request #7116 from yujuhong/container_status
Print container statuses in `kubectl get pods`

@vmarmol vmarmol merged commit 1a41ec9 into kubernetes:master Apr 22, 2015

4 checks passed

Shippable Shippable builds completed
Details
cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.07%) to 53.39%
Details
@timothysc

This comment has been minimized.

Show comment
Hide comment
@timothysc

timothysc Apr 23, 2015

Member

@rrati @jayunit100 fyi.
Nice this is useful.
We could probably close out the the originating ticket chain that stem'd from this.

Member

timothysc commented Apr 23, 2015

@rrati @jayunit100 fyi.
Nice this is useful.
We could probably close out the the originating ticket chain that stem'd from this.

ncdc pushed a commit to ncdc/origin that referenced this pull request May 5, 2015

Andy Goldstein
Fix grep for registry pod in e2e
kubernetes/kubernetes#7116 changed the
pod output to display container status on individual lines.

smarterclayton added a commit to smarterclayton/origin that referenced this pull request May 5, 2015

Fix grep for registry pod in e2e
kubernetes/kubernetes#7116 changed the
pod output to display container status on individual lines.

smarterclayton added a commit to smarterclayton/origin that referenced this pull request May 5, 2015

Fix grep for registry pod in e2e
kubernetes/kubernetes#7116 changed the
pod output to display container status on individual lines.

@yujuhong yujuhong deleted the yujuhong:container_status branch May 8, 2015

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