How to display a pods age?

11/22/2019

I am working on two servers, each with a number of pods. The first server is Validation Env and I can use kubernetes commands, but the second server is on Prod Env I do not have full rights. It is out of the question to get full rights on the last one.

So, I am doing a platform stability statistic and I need info about the last reset of pods. I can see the "Age" but I cannot use a screenshot in my statistic, so I need a command that outputs every pods age or the last reset.

P.S. Every night at 00:00 the pods are saved and archived in a separate folder.

-- Rareshu
kubernetes
production
server

2 Answers

11/22/2019

I found a solution:

command:
zgrep "All subsystems started successfully" 201911??/*ota*

response:
23:23:37,429 [INFO ] main c.o.c.a.StartUp - All subsystems started successfully

P.S. "ota" is my pod's name.

-- Rareshu
Source: StackOverflow

11/22/2019

Get pods already gives you that info:

$ kubectl get po
NAME                     READY   STATUS        RESTARTS   AGE
nginx-7cdbd8cdc9-8pnzq   1/1     Running       0          36s
$ kubectl delete po nginx-7cdbd8cdc9-8pnzq
pod "nginx-7cdbd8cdc9-8pnzq" deleted
$ kubectl get po
NAME                     READY   STATUS        RESTARTS   AGE
nginx-7cdbd8cdc9-67l8l   1/1     Running       0          4s
-- suren
Source: StackOverflow