Description of problem: Removing and recreating a static pod can leave it in an error state. Upstream issue: https://github.com/kubernetes/kubernetes/issues/104648
*** Bug 2001078 has been marked as a duplicate of this bug. ***
test on 4.10.0-0.nightly-2021-10-13-081040, I think the issue is fixed, but it's better not to show "RESTARTS 1 (26s ago)" in output of "oc get pod"(Please see my following steps) @Ryan, what do you think? create a static pod in /etc/kubernetes/manifests sh-4.4# echo ' > kind: Pod > apiVersion: v1 > metadata: > name: mypod > spec: > terminationGracePeriodSeconds: 1 > containers: > - name: busybox > image: busybox > command: ["sh", "-c", "echo $RANDOM; sleep 100000"] > ' > mypod.yaml $ oc get pod NAME READY STATUS RESTARTS AGE ip-10-0-189-142us-east-2computeinternal-debug 1/1 Running 0 2m7s mypod-ip-10-0-189-142.us-east-2.compute.internal 1/1 Running 0 17s remove and recreate the static pod sh-4.4# rm mypod.yaml sh-4.4# echo ' > kind: Pod > apiVersion: v1 > metadata: > name: mypod > spec: > terminationGracePeriodSeconds: 1 > containers: > - name: busybox > image: busybox > command: ["sh", "-c", "echo $RANDOM; sleep 100000"] > ' > mypod.yaml $ oc get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES ip-10-0-189-142us-east-2computeinternal-debug 1/1 Running 0 6m42s 10.0.189.142 ip-10-0-189-142.us-east-2.compute.internal <none> <none> mypod-ip-10-0-189-142.us-east-2.compute.internal 1/1 Running 1 (26s ago) 6s 10.128.2.109 ip-10-0-189-142.us-east-2.compute.internal <none> <none> // here, the pod recreate, but it show AGE 6s, RESTARTS 1 (26s ago), it's not reasonable.
Looks like it worked fine...
Hi, Ryan I mean the pod's AGE is 6s, but RESTARTS "26s ago", that mean the pod restart before it is created. It's not reasonable in term of time. If kubelet take the removal of the same static pod manifest as a restart, it should not recalculate pod's AGE. $ oc get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES ip-10-0-189-142us-east-2computeinternal-debug 1/1 Running 0 6m42s 10.0.189.142 ip-10-0-189-142.us-east-2.compute.internal <none> <none> mypod-ip-10-0-189-142.us-east-2.compute.internal 1/1 Running 1 (26s ago) 6s 10.128.2.109 ip-10-0-189-142.us-east-2.compute.internal <none> <none> // here, the pod recreate, but it show AGE 6s, RESTARTS 1 (26s ago), it's not reasonable.
confirm with Ryan, this is a static pod and it has different rules behind it. the test here is to make sure the pod restarts, verified!
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: OpenShift Container Platform 4.10.3 security update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:0056