如何在Spring Boot Log中识别由live_probe触发的pod重启活动?



我正在使用一个Spring Boot应用程序。我已经包含了使用REST API端点的http活动探测配置。因此,当REST API无法访问时,Kubernetes将重新启动pod。

问题是,我需要确定是否有办法区分由Liveness Probe触发的pod重启活动和部署团队完成的手动重启。

当Kubernetes重新启动pod时,在Spring Boot日志中是否包含任何类型的日志信息?

如果您描述pod,如果存在活动探测失败,您应该看到一条消息Liveness probe failed

kubectl describe pod liveness-exec
FirstSeen LastSeen    Count   From            SubobjectPath           Type        Reason      Message
--------- --------    -----   ----            -------------           --------    ------      -------
37s       37s     1   {default-scheduler }                    Normal      Scheduled   Successfully assigned liveness-exec to worker0
36s       36s     1   {kubelet worker0}   spec.containers{liveness}   Normal      Pulling     pulling image "k8s.gcr.io/busybox"
36s       36s     1   {kubelet worker0}   spec.containers{liveness}   Normal      Pulled      Successfully pulled image "k8s.gcr.io/busybox"
36s       36s     1   {kubelet worker0}   spec.containers{liveness}   Normal      Created     Created container with docker id 86849c15382e; Security:[seccomp=unconfined]
36s       36s     1   {kubelet worker0}   spec.containers{liveness}   Normal      Started     Started container with docker id 86849c15382e
2s        2s      1   {kubelet worker0}   spec.containers{liveness}   Warning     Unhealthy   Liveness probe failed: cat: can't open '/tmp/healthy': No such file or directory

相关内容

  • 没有找到相关文章

最新更新