as a preparation I'll tell what I know
When I run kubectl logs --previous <pod_name> I'll get last 20lines of logs before restart and timestamp when than happened, but I wanted to have that timestamp displayed when I run kubectl get pods as an additional column.
The kube docs on how to create custom columns show that
kubectl get pods <my_pod_name -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion
NAME RSRC
submit-queue 610995
but my question is where is this metadata/spec stored??? where can I list all possible metadata so I know what column to search or write, and same for spec and any other possible column
I know I can look at the pod with kubectl describe pod <pod> but how do I translate fields there to this .metadata.name format ?
Part of my descirbe looks like so
MacBook-Pro% kubectl describe pod xxx
Name: xxx
Namespace: xx
Priority: 0
Node: myname/myip
Start Time: Tue, 23 Feb 2021 11:37:01 +0100
Labels: app=xx
app.kubernetes.io/instance=xx
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=xx
env=xx
helm.sh/chart=xx
pod-template-hash=yy
Annotations: kubectl.kubernetes.io/restartedAt: 2020-10-23T11:21:09+02:00
Status: Running
IP: 10.xx
IPs:
IP: 10.xx
Controlled By: ReplicaSet/xxx
Containers:
my_app:
Container ID: docker://xxxx
Image: gcr.ioxxxx
Image ID: docker-pullable://gcrxxx
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Fri, 12 Mar 2021 11:34:42 +0100
Last State: Terminated
Reason: Error
Exit Code: 143
Started: Fri, 05 Mar 2021 12:34:58 +0100
Finished: Fri, 12 Mar 2021 11:34:41 +0100
any thought how to get to Last State.Finished field ?
Would appreciate any help, thanks.