-
Notifications
You must be signed in to change notification settings - Fork 42.1k
Description
What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.): Pod status started null, started, 01 Jan 0001
Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.3", GitCommit:"0480917b552be33e2dba47386e51decb1a211df6", GitTreeState:"clean", BuildDate:"2017-05-10T15:48:59Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.3", GitCommit:"0480917b552be33e2dba47386e51decb1a211df6", GitTreeState:"clean", BuildDate:"2017-05-10T15:38:08Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}`
Environment:
- Cloud provider or hardware configuration: -
- OS (e.g. from /etc/os-release): CentOS 7
- Kernel (e.g.
uname -a):Linux 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux - Install tools: kubeadm 1.6
What happened:
When a pod is created and starts running, kubectl describe pod-name shows the correct container start time in Containers -> containername -> State -> Started. After the container is terminated, the start time changes to Mon, 01 Jan 0001 00:00:00 +0000. In addition, kubectl get pod-name -o json shows that status.containerStatuses[0].state.terminated.startedAt is null.
What you expected to happen:
I'm expecting the start time to not change after the pod is terminated, so that afterwards I could check how long a time the container execution took.
How to reproduce it (as minimally and precisely as possible):
Have a running kubernetes cluster, and create a pod with the following command:
kubectl create -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: sleep
spec:
containers:
- name: sleep
image: ubuntu
command: ["sleep"]
args: ["30"]
restartPolicy: Never
EOF
This created a container that sleeps for 30 seconds and quits. During those 30 seconds, check the pod status with kubectl describe po sleep:
...
State: Running
Started: Wed, 17 May 2017 10:25:22 +0300
...
After 30 seconds, check the status of the terminated container with kubectl describe po sleep again:
...
State: Terminated
Reason: Completed
Exit Code: 0
Started: Mon, 01 Jan 0001 00:00:00 +0000
Finished: Wed, 17 May 2017 10:25:52 +0300
...
With kubectl get po sleep -o json we see that the container's start time is null:
...
"state": {
"terminated": {
"containerID": "docker://ca0dbe0dab3bb91ad0b05ac167e44d5fbf805f736ef98f61b9e106ba4456667f",
"exitCode": 0,
"finishedAt": "2017-05-17T07:25:52Z",
"reason": "Completed",
"startedAt": null
}
}
...
Anything else we need to know:
I need to measure container run durations and this bug prevents me from doing so.