New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在k8s 临时容器 ephemeral container里 attach 问题 #1874
Comments
测试 jdk17 启动应用容器
doockerfile
用临时容器debug临时容器的dockerfile
执行命令
然后在容器里直接执行jps是没有结果的,复制进程1的
再在临时容器里测试 arthas:
结果attach时出错
原因是arthas-boot把arthas文件下载到临时容器的 要解决这个问题,要把arthas的文件放到 应用容器能读取到的目录下。
然后就可以attach成功了。
所以总结下来,本质上要解决两个问题:
最简便的办法是 临时容器能和应用容器共享 |
您好。按照您的思路,我在k8s中进行了尝试。希望通过边车模式,主容器与副容器共享/tmp目录,然后在主容器中运行Java程序,副容器运行arthas对主容器中应用进行监控。
pod成功启动后,进入到副容器的/tmp目录下,下载arthas-boot.jar并运行,然后
但当输入数字1之后,仍然出现了跟您上面一样的报错信息
但是我已将两个容器共享了/tmp目录,并将安装arthas的副容器的 |
@yjustdo 和 arthas查找 jar 目录有关。 要cd到 arthas目录下面执行启动。 出错的信息来看,还是应用进程加载不到 副容器里的文件的问题。 试下启动前增加 |
谢谢。
|
用最新版本的 jattach 可以加载 agent,不过这个每个平台的二进制文件都不同,会增大复杂度和文件体积。 另外,使用 jattach 仍然要把文件复制到 /proc/$pid/root/ 目录下。 |
@hengyunabc 能具体说一下如何 用jattach 加载 arthas吗?谢谢 |
|
我的容器是基于alpine的 jre(没有jdk)。 bash-4.4# ps -ef
PID USER TIME COMMAND
1 root 0:00 bash /usr/local/tomcat/bin/catalina.sh run | tee -a logs/catalina.out
9 root 13:07 /usr/lib/jvm/java-1.8-openjdk/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.mana
bash-4.4# pwd
/proc/9/root
bash-4.4# jattach 9 load instrument false "/proc/9/root/arthas-core.jar"
Connected to remote JVM
Response code = 0
100 请问我该如何使用 arthas 的 Dashboard 等功能呢? |
请教下jdk8,目前有办法attach上么?@hengyunabc |
试下共享 |
谢谢,以通过参考方法和#362已解决。 |
测试版本信息
start k8s
start a simple java pod:
Dockerfile:
Check pods status:
Debug ephemeral containers
ps 可以看到进程,但是jps看不到,并且jstack -l失败
尝试
尝试把应用容器里的
/tmp/hsperfdata_root/
目录复制到临时容器里,仍然失败:The text was updated successfully, but these errors were encountered: