.status.containerStatuses

From wikieduonline
Jump to navigation Jump to search
.status.containerStatuses
 kubectl get pod YOUR_POD -o json | jq '.status.containerStatuses[] | {name: .name, startedAt: .state.running.startedAt}'

Boot time order by time[edit]

kubectl get pods -n YOUR_NS -o json | jq -r '
  ["POD", "CONTAINER", "STARTED_AT"],
  (
    [
      .items[]
      | .metadata.name as $pod
      | (.status.containerStatuses // [])[]
      | select(.state.running != null)
      | {pod: $pod, container: .name, startedAt: .state.running.startedAt}
    ]
    | sort_by(.startedAt)
    | reverse[]
    | [.pod, .container, .startedAt]
  )
  | @tsv
' | column -t

See also[edit]

Advertising: