简体   繁体   English

如何在 kube.netes 上运行的 distroless 容器上获取 java 应用程序的线程转储?

[英]how to take thread dump of java application on a distroless container running on kubernetes?

My cluster have many java applications running on it, I would like to take thread dump for few microservices.我的集群上运行着许多 java 应用程序,我想对一些微服务进行线程转储。 But as these are distroless images, I was thinking of ephemeral containers but not sure if volume can be attached to such containers.但由于这些是 distroless 图像,我在考虑临时容器,但不确定是否可以将卷附加到此类容器。 Can someone help?有人可以帮忙吗?

Regards, Anjani问候,安贾尼

Are you using Spring Boot to build those microservices?您是否使用 Spring Boot 来构建这些微服务? If yes, then by using Spring Boot Admin you can get thread dumps, heap dumps and monitor your services from a single window.如果是,那么通过使用 Spring Boot Admin,您可以从单个 window 获取线程转储、堆转储并监控您的服务。

Please check here to get more details about it.在此处查看以获取有关它的更多详细信息。

Check Spring Boot actuator endpoints https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints检查 Spring 引导执行器端点https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints

There is a dedicated endpoint for thread dumps.线程转储有一个专用端点。 Note that by default it returns custom JSON format, but you could request default text format.请注意,默认情况下它返回自定义 JSON 格式,但您可以请求默认文本格式。

curl 'http://localhost:8080/actuator/threaddump' -i -X GET \
-H 'Accept: text/plain'

See for more details https://docs.spring.io/spring-boot/docs/current/actuator-api/htmlsingle/#threaddump.retrieving-text有关详细信息,请参阅https://docs.spring.io/spring-boot/docs/current/actuator-api/htmlsingle/#threaddump.retrieving-text

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kubernetes:如何获取应用程序的线程转储 - Kubernetes: How to take a thread dump of an app Kubernetes:如何在 distroless 容器上模拟活性探测? - Kubernetes: How to simulate a liveness probe on distroless containers? k8s如何执行distroless容器 - k8s how to exec to distroless container 将时间戳添加到从 kubernetes pod 中运行的 java 应用程序生成的堆转储文件名中 - Adding the timestamp to heap dump filename generated from java application running in kubernetes pod 从 pod 中运行的 Kubernetes 容器导出 MySQL DB 转储 - Export MySQL DB dump from Kubernetes container running in a pod 如何将输入传递给 Kubernetes 容器内的 Java 应用程序? - How can I pass input to Java application inside the Kubernetes container? 在kubernetes容器中运行Java应用程序不起作用 - Running java app in kubernetes container is not working 建议在 Kubernetes 上运行 Java SE 容器应用程序 - Recommendations to run a Java SE container application on Kubernetes 如何将 docker 容器添加到正在运行的 kube.netes pod? - How to add a docker container to a running kubernetes pod? 如何在具有运行中的spring-boot应用程序的kubernetes容器/容器中运行cron? - How do I run a cron inside a kubernetes pod/container which has a running spring-boot application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM