Events:TypeReasonAgeFromMessage-------------------------NormalScheduled1mdefault-schedulerSuccessfullyassignedliveness-exectonode1NormalSuccessfulMountVolume1mkubelet,node1MountVolume.SetUpsucceededforvolume"default-token-8lv8j" Normal Pulling 1m kubelet, node1 pulling image "registry.cn-hangzhou.aliyuncs.com/misa/busybox:1.28"
Normal Pulled 18s kubelet, node1 Successfully pulled image "registry.cn-hangzhou.aliyuncs.com/misa/busybox:1.28"
NormalCreated18skubelet,node1CreatedcontainerNormalStarted18skubelet,node1Startedcontainer
启动35秒后,再次查看pod的event:
kubectldescribepodliveness-exec
在最下面有一条信息显示liveness probe失败,容器被删掉并重新创建。
Events:TypeReasonAgeFromMessage-------------------------NormalScheduled11mdefault-schedulerSuccessfullyassignedliveness-exectonode1 Normal SuccessfulMountVolume 11m kubelet, node1 MountVolume.SetUp succeeded for volume "default-token-8lv8j"
Normal Pulling 11m kubelet, node1 pulling image "registry.cn-hangzhou.aliyuncs.com/misa/busybox:1.28"
Normal Pulled 10m kubelet, node1 Successfully pulled image "registry.cn-hangzhou.aliyuncs.com/misa/busybox:1.28"
NormalStarted8m (x3 over10m) kubelet, node1 Started containerNormalCreated6m (x4 over10m) kubelet, node1 Created container Normal Killing 6m (x3 over 9m) kubelet, node1 Killing container with id docker://liveness:Container failed liveness probe.. Container will be killed and recreated.
Normal Pulled 6m (x3 over 9m) kubelet, node1 Container image "registry.cn-hangzhou.aliyuncs.com/misa/busybox:1.28" already present on machine
Warning Unhealthy 1m (x19 over 9m) kubelet, node1 Liveness probe failed: cat: can't open '/tmp/healthy': No such file or directory
再等30秒,确认容器已经重启: kubectl get pod liveness-exec 从输出结果来RESTARTS值加1了。 NAME READY STATUS RESTARTS AGE liveness-exec 1/1 Running 1 1m