2

I am trying to debug a java app on GKE cluster through stack driver. I have created a GKE cluster with Allow full access to all Cloud APIs I am following documentation: https://cloud.google.com/debugger/docs/setup/java

Here is my DockerFile:

FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} alnt-watchlist-microservice.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/alnt-watchlist-microservice.jar"]

In documentation, it was written to add following lines in DockeFile:

RUN  mkdir /opt/cdbg && \
     wget -qO- https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz | \
     tar xvz -C /opt/cdbg

RUN java -agentpath:/opt/cdbg/cdbg_java_agent.so 
    -Dcom.google.cdbg.module=tpm-watchlist
    -Dcom.google.cdbg.version=v1
    -jar /alnt-watchlist-microservice.jar

When I build DockerFile, It fails saying tar: invalid magic , tar: short read.

In stackdriver debug console, It always show 'No deployed application found'. Which application it will show? I have already 2 services deployed on my kubernetes cluster.

I have already executed gcloud debug source gen-repo-info-file --output-directory="WEB-INF/classes/ in my project's directory.

It generated source-context.json. After its creation, I tried building docker image and its failing.

Roobal Jindal
  • 214
  • 2
  • 13

3 Answers3

2

The debugger will be ready for use when you deploy your containerized app. You are getting No deployed application found error because your debugger agent is failing to download or unzip in dockerfile.

Please check this discussion to resolve the tar: invalid magic , tar: short read. error.

Mahesh Khond
  • 1,297
  • 1
  • 14
  • 31
  • There were 2 options: Either you manually download and extract opt/cdbg/cdbg_java_agent.so or enable give access to all cloud APIs. I chose later one. I dont think I need to extract agent now. I have also used Google-provided base images for Java. Anything else I need to do? I am still not able to see any application to debug. – Roobal Jindal Nov 18 '19 at 07:40
1

Unfortunately it looks like Alpine isn't regularly tested with Debugger. There's a sample setup here that might help you: https://github.com/GoogleCloudPlatform/cloud-debug-java#alpine-linux

wjg
  • 21
  • 1
  • 3
0

I resolved the issue.

Firstly, you will have to use java image "gcr.io/google-appengine/openjdk" instead of Alpine one.

Secondly, I was putting entry points without comma separated (Basically in wrong format)

ENTRYPOINT ["java","-agentpath:/opt/cdbg/cdbg_java_agent.so", "-Djava.security.egd=file:/dev/./urandom"  ,"-Dcom.google.cdbg.module=watchlist"]

Roobal Jindal
  • 214
  • 2
  • 13