Change:
Problem When a container is killed and restarted because, for example, it hit memory limits, the output only shows an increasing but no reason for why the container was killed: We can find the reason by inspecting the pod object ( shows as with ): Suggested Solution Modify to print termination reason, if available.
When this merges, need to update Search for in that doc.
Solved with .

Discussion:
```console [12:54:41] $ ./cluster/kubectl.sh describe pod simmemleak-hra99 <del> Name:               simmemleak-hra99 Namespace:          default Image(s):           saadali/simmemleak Node:               kubernetes-minion-tf0f/10.240.216.66 Labels:             name=simmemleak Status:             Running </del> <ins> Name:                           simmemleak-hra99 Namespace:                      default Image(s):                       saadali/simmemleak Node:                           kubernetes-minion-tf0f/10.240.216.66 Labels:                         name=simmemleak Status:                         Running </ins> Reason: Message: <del> IP:             10.244.2.75 Replication Controllers:    simmemleak (1/1 replicas created) </del> <ins> IP:                             10.244.2.75 Replication Controllers:        simmemleak (1/1 replicas created) </ins> Containers: simmemleak: Image:  saadali/simmemleak Limits: <del> cpu:      100m memory:       50Mi State:      Running Started:      Tue, 07 Jul 2015 12:54:41 -0700 Ready:      False Restart Count:  5 </del> <ins> cpu:                      100m memory:                   50Mi State:                      Running Started:                  Tue, 07 Jul 2015 12:54:41 -0700 Last Termination State:     Terminated Exit Code:                1 Started:                  Fri, 07 Jul 2015 12:54:30 -0700 Finished:                 Fri, 07 Jul 2015 12:54:33 -0700 Ready:                      False Restart Count:              5 </ins> Conditions: Type      Status Ready     False

The `Restart Count:  5` indicates that the `simmemleak` container in this pod was terminated and restarted 5 times. <del> Once [#10861](http://issue.k8s.io/10861) is resolved the reason for the termination of the last container will also be printed in this output. Until then you can call `get pod` with the `-o template -t ...` option to fetch the status of previously terminated containers: </del> <ins> You can call `get pod` with the `-o template -t ...` option to fetch the status of previously terminated containers: </ins> ```console [13:59:01] $ ./cluster/kubectl.sh  get pod -o template -t '{{range.status.containerStatuses}}{{"Container Name: "}}{{.name}}{{"rnLastState: "}}{{.lastState}}{{end}}'  simmemleak-60xbc

fmt.Fprintf(out, "      %s:t%sn", name, quantity.String()) } <del> switch { case state.Running != nil: fmt.Fprintf(out, "    State:tRunningn") fmt.Fprintf(out, "      Started:t%vn", state.Running.StartedAt.Time.Format(time.RFC1123Z)) case state.Waiting != nil: fmt.Fprintf(out, "    State:tWaitingn") if state.Waiting.Reason != "" { fmt.Fprintf(out, "      Reason:t%sn", state.Waiting.Reason) } case state.Terminated != nil: fmt.Fprintf(out, "    State:tTerminatedn") if state.Terminated.Reason != "" { fmt.Fprintf(out, "      Reason:t%sn", state.Terminated.Reason) } if state.Terminated.Message != "" { fmt.Fprintf(out, "      Message:t%sn", state.Terminated.Message) } fmt.Fprintf(out, "      Exit Code:t%dn", state.Terminated.ExitCode) if state.Terminated.Signal > 0 { fmt.Fprintf(out, "      Signal:t%dn", state.Terminated.Signal) } fmt.Fprintf(out, "      Started:t%sn", state.Terminated.StartedAt.Time.Format(time.RFC1123Z)) fmt.Fprintf(out, "      Finished:t%sn", state.Terminated.FinishedAt.Time.Format(time.RFC1123Z)) default: fmt.Fprintf(out, "    State:tWaitingn") </del> <ins> describeStatus("State", state, out) if status.LastTerminationState.Terminated != nil { describeStatus("Last Termination State", status.LastTerminationState, out) </ins> } fmt.Fprintf(out, "    Ready:t%vn", printBool(status.Ready)) fmt.Fprintf(out, "    Restart Count:t%dn", status.RestartCount) fmt.Fprintf(out, "    Variables:n")

return valueFrom } <ins> func describeStatus(stateName string, state api.ContainerState, out io.Writer) { switch { case state.Running != nil: fmt.Fprintf(out, "    %s:tRunningn", stateName) fmt.Fprintf(out, "      Started:t%vn", state.Running.StartedAt.Time.Format(time.RFC1123Z)) case state.Waiting != nil: fmt.Fprintf(out, "    %s:tWaitingn", stateName) if state.Waiting.Reason != "" { fmt.Fprintf(out, "      Reason:t%sn", state.Waiting.Reason) } case state.Terminated != nil: fmt.Fprintf(out, "    %s:tTerminatedn", stateName) if state.Terminated.Reason != "" { fmt.Fprintf(out, "      Reason:t%sn", state.Terminated.Reason) } if state.Terminated.Message != "" { fmt.Fprintf(out, "      Message:t%sn", state.Terminated.Message) } fmt.Fprintf(out, "      Exit Code:t%dn", state.Terminated.ExitCode) if state.Terminated.Signal > 0 { fmt.Fprintf(out, "      Signal:t%dn", state.Terminated.Signal) } fmt.Fprintf(out, "      Started:t%sn", state.Terminated.StartedAt.Time.Format(time.RFC1123Z)) fmt.Fprintf(out, "      Finished:t%sn", state.Terminated.FinishedAt.Time.Format(time.RFC1123Z)) default: fmt.Fprintf(out, "    %s:tWaitingn", stateName) } } </ins> func printBool(value bool) string { if value { return "True"

}, expectedElements: []string{"test", "State", "Terminated", "Ready", "True", "Restart Count", "7", "Image", "image", "Reason", "potato", "Started", "Finished", "Exit Code", "2"}, }, <ins> // Last Terminated { container: api.Container{Name: "test", Image: "image"}, status: api.ContainerStatus{ Name: "test", State: api.ContainerState{ Running: &api.ContainerStateRunning{ StartedAt: util.NewTime(time.Now()), }, }, LastTerminationState: api.ContainerState{ Terminated: &api.ContainerStateTerminated{ StartedAt:  util.NewTime(time.Now().Add(time.Second * 3)), FinishedAt: util.NewTime(time.Now()), Reason:     "crashing", ExitCode:   3, }, }, Ready:        true, RestartCount: 7, }, expectedElements: []string{"test", "State", "Terminated", "Ready", "True", "Restart Count", "7", "Image", "image", "Started", "Finished", "Exit Code", "2", "crashing", "3"}, }, </ins> // No state defaults to waiting. { container: api.Container{Name: "test", Image: "image"},