[alibaba/arthas]k8s容器部署项目引入arthas依赖,启动不会注册到arthas-tunnel-server

2024-07-17 521 views
3
环境信息
  • Arthas 版本: arthas-tunnel-server-3.6.9-fatjar.jar
  • 目标进程的JVM版本: openjdk:8-jdk-alpine
  • 执行arthas-boot的版本: arthas-spring-boot-starter 3.6.9
重现问题的步骤
  1. 启动arthas-tunnel-server
  2. k8s容器部署的项目引入了arthas依赖,启动不会注册到arthas-tunnel-server
  3. 我本机启动同一个项目用同样的配置可以注册到arthas-tunnel-server
  4. 没出现报错信息,引入依赖的client项目也都显示了 Arthas agent start success.
期望的结果

k8s容器部署的项目启动后可以注册到arthas-tunnel-server

实际运行的结果

不会注册

// 容器项目启动日志
2023-06-18 23:26:51.262  INFO 7 --- [           main] c.a.n.c.c.impl.LocalConfigInfoProcessor  : LOCAL_SNAPSHOT_PATH:/root/nacos/config

 2023-06-18 23:26:52.070  INFO 7 --- [           main] c.a.nacos.client.config.impl.Limiter     : limitTime:5.0

 2023-06-18 23:26:52.273  WARN 7 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[cicd-k8s] & group[DEFAULT_GROUP]

 2023-06-18 23:26:52.277  WARN 7 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[cicd-k8s.yaml] & group[DEFAULT_GROUP]

 2023-06-18 23:26:52.357  WARN 7 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[cicd-k8s-prod.yaml] & group[DEFAULT_GROUP]

 2023-06-18 23:26:52.371  INFO 7 --- [           main] com.hzg.demo.DemoApplication             : The following profiles are active: prod

 2023-06-18 23:26:58.759  WARN 7 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.

 2023-06-18 23:27:00.762  INFO 7 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]

 2023-06-18 23:27:00.763  INFO 7 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.43]

 2023-06-18 23:27:00.969  INFO 7 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext

 2023-06-18 23:27:04.267  INFO 7 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Property :null

 2023-06-18 23:27:04.268  INFO 7 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Environment :null

 2023-06-18 23:27:04.268  INFO 7 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Property :null

 2023-06-18 23:27:05.269  WARN 7 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.

 2023-06-18 23:27:05.269  INFO 7 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

 2023-06-18 23:27:05.275  WARN 7 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.

 2023-06-18 23:27:05.275  INFO 7 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

 2023-06-18 23:27:07.263  WARN 7 --- [           main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)

 2023-06-18 23:27:13.667  INFO 7 --- [           main] c.a.arthas.spring.ArthasConfiguration    : Arthas agent start success.

 2023-06-18 23:27:15.365  INFO 7 --- [           main] com.alibaba.nacos.client.naming          : new ips(2) service: DEFAULT_GROUP@@cicd-k8s@@DEFAULT -> [{"instanceId":"192.168.200.1#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"192.168.200.1","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000},{"instanceId":"10.233.96.136#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"10.233.96.136","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]

 2023-06-18 23:27:15.371  INFO 7 --- [           main] com.alibaba.nacos.client.naming          : current ips:(2) service: DEFAULT_GROUP@@cicd-k8s@@DEFAULT -> [{"instanceId":"10.233.96.136#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"10.233.96.136","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000},{"instanceId":"192.168.200.1#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"192.168.200.1","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]

 2023-06-18 23:27:15.657  INFO 7 --- [           main] com.alibaba.nacos.client.naming          : [BEAT] adding beat: BeatInfo{port=8002, ip='10.233.96.140', weight=1.0, serviceName='DEFAULT_GROUP@@cicd-k8s', cluster='DEFAULT', metadata={preserved.register.source=SPRING_CLOUD}, scheduled=false, period=5000, stopped=false} to beat map.

 2023-06-18 23:27:15.658  INFO 7 --- [           main] com.alibaba.nacos.client.naming          : [REGISTER-SERVICE] 4b7962f4-e5b5-42fe-b3fb-c4df021c71f6 registering service DEFAULT_GROUP@@cicd-k8s with instance: Instance{instanceId='null', ip='10.233.96.140', port=8002, weight=1.0, healthy=true, enabled=true, ephemeral=true, clusterName='DEFAULT', serviceName='null', metadata={preserved.register.source=SPRING_CLOUD}}

 2023-06-18 23:27:15.662  INFO 7 --- [           main] c.a.c.n.registry.NacosServiceRegistry    : nacos registry, DEFAULT_GROUP cicd-k8s 10.233.96.140:8002 register finished

 2023-06-18 23:27:16.658  INFO 7 --- [.naming.updater] com.alibaba.nacos.client.naming          : new ips(1) service: DEFAULT_GROUP@@cicd-k8s@@DEFAULT -> [{"instanceId":"10.233.96.140#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"10.233.96.140","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]

 2023-06-18 23:27:16.659  INFO 7 --- [.naming.updater] com.alibaba.nacos.client.naming          : current ips:(3) service: DEFAULT_GROUP@@cicd-k8s@@DEFAULT -> [{"instanceId":"10.233.96.140#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"10.233.96.140","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000},{"instanceId":"10.233.96.136#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"10.233.96.136","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000},{"instanceId":"192.168.200.1#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"192.168.200.1","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]

 2023-06-18 23:27:17.259  INFO 7 --- [           main] com.hzg.demo.DemoApplication             : Started DemoApplication in 30.188 seconds (JVM running for 32.469)

 2023-06-18 23:27:17.376  INFO 7 --- [           main] c.a.n.client.config.impl.ClientWorker    : [fixed-192.168.200.128_8848-4b7962f4-e5b5-42fe-b3fb-c4df021c71f6] [subscribe] cicd-k8s.yaml+DEFAULT_GROUP+4b7962f4-e5b5-42fe-b3fb-c4df021c71f6

 2023-06-18 23:27:17.377  INFO 7 --- [           main] c.a.nacos.client.config.impl.CacheData   : [fixed-192.168.200.128_8848-4b7962f4-e5b5-42fe-b3fb-c4df021c71f6] [add-listener] ok, tenant=4b7962f4-e5b5-42fe-b3fb-c4df021c71f6, dataId=cicd-k8s.yaml, group=DEFAULT_GROUP, cnt=1

 2023-06-18 23:27:17.377  INFO 7 --- [           main] c.a.n.client.config.impl.ClientWorker    : [fixed-192.168.200.128_8848-4b7962f4-e5b5-42fe-b3fb-c4df021c71f6] [subscribe] cicd-k8s-prod.yaml+DEFAULT_GROUP+4b7962f4-e5b5-42fe-b3fb-c4df021c71f6

 2023-06-18 23:27:17.377  INFO 7 --- [           main] c.a.nacos.client.config.impl.CacheData   : [fixed-192.168.200.128_8848-4b7962f4-e5b5-42fe-b3fb-c4df021c71f6] [add-listener] ok, tenant=4b7962f4-e5b5-42fe-b3fb-c4df021c71f6, dataId=cicd-k8s-prod.yaml, group=DEFAULT_GROUP, cnt=1

 2023-06-18 23:27:17.378  INFO 7 --- [           main] c.a.n.client.config.impl.ClientWorker    : [fixed-192.168.200.128_8848-4b7962f4-e5b5-42fe-b3fb-c4df021c71f6] [subscribe] cicd-k8s+DEFAULT_GROUP+4b7962f4-e5b5-42fe-b3fb-c4df021c71f6

 2023-06-18 23:27:17.378  INFO 7 --- [           main] c.a.nacos.client.config.impl.CacheData   : [fixed-192.168.200.128_8848-4b7962f4-e5b5-42fe-b3fb-c4df021c71f6] [add-listener] ok, tenant=4b7962f4-e5b5-42fe-b3fb-c4df021c71f6, dataId=cicd-k8s, group=DEFAULT_GROUP, cnt=1

 2023-06-18 23:27:25.264  INFO 7 --- [nio-8002-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'

 2023-06-18 23:27:26.664  INFO 7 --- [.naming.updater] com.alibaba.nacos.client.naming          : removed ips(1) service: DEFAULT_GROUP@@cicd-k8s@@DEFAULT -> [{"instanceId":"10.233.96.136#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"10.233.96.136","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]

 2023-06-18 23:27:26.665  INFO 7 --- [.naming.updater] com.alibaba.nacos.client.naming          : current ips:(2) service: DEFAULT_GROUP@@cicd-k8s@@DEFAULT -> [{"instanceId":"10.233.96.140#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"10.233.96.140","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000},{"instanceId":"192.168.200.1#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"192.168.200.1","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]

 2023-06-18 23:27:56.684  INFO 7 --- [.naming.updater] com.alibaba.nacos.client.naming          : new ips(1) service: DEFAULT_GROUP@@cicd-k8s@@DEFAULT -> [{"instanceId":"10.233.90.222#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"10.233.90.222","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]

 2023-06-18 23:27:56.686  INFO 7 --- [.naming.updater] com.alibaba.nacos.client.naming          : current ips:(3) service: DEFAULT_GROUP@@cicd-k8s@@DEFAULT -> [{"instanceId":"10.233.96.140#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"10.233.96.140","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000},{"instanceId":"10.233.90.222#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"10.233.90.222","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000},{"instanceId":"192.168.200.1#8002#DEFAULT#DEFAULT_GROUP@@cicd-k8s","ip":"192.168.200.1","port":8002,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@cicd-k8s","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]

// arthas-tunnel-server日志
2023-06-18 23:27:02.257  INFO 32010 --- [Server-boss-4-1] io.netty.handler.logging.LoggingHandler  : [id: 0xc7962aa0, L:/0:0:0:0:0:0:0:0:7777] READ: [id: 0x6a3b37d8, L:/192.168.200.20:7777 - R:/192.168.200.1:51579]
2023-06-18 23:27:02.257  INFO 32010 --- [Server-boss-4-1] io.netty.handler.logging.LoggingHandler  : [id: 0xc7962aa0, L:/0:0:0:0:0:0:0:0:7777] READ COMPLETE
2023-06-18 23:27:02.279  INFO 32010 --- [rver-worker-5-9] c.a.a.t.server.TunnelSocketFrameHandler  : websocket handshake complete, uri: /ws?method=agentRegister&arthasVersion=3.6.9&appName=cicd-k8s

![Uploading image.png…]()

回答

6

兄弟 解决了吗 @henric-huang