Skip to content

Use the JavaAgent on a read-only filesytem #1673

Closed
@florianrusch

Description

@florianrusch

Is your feature request related to a problem? Please describe.

Yes – on kubernetes it's a best practise to start the pods/container with a read-only filesystem to prevent certain attacks on the infrastructure. Sadly the applicationinsights java agent seems to need write permissions at least at this location: /tmp/applicationinsights-java

Describe the solution you would like

I would like to usr the java agent on a read only filesystem.

Additional context

Error message:

2021-05-05 06:05:47.518Z ERROR c.m.applicationinsights.agent - ApplicationInsights Java Agent 3.0.4-BETA failed to start
java.lang.IllegalStateException: Could not create directory: /tmp/applicationinsights-java
	at com.microsoft.applicationinsights.agent.internal.AiComponentInstaller.start(AiComponentInstaller.java:120)
	at com.microsoft.applicationinsights.agent.internal.AiComponentInstaller.beforeByteBuddyAgent(AiComponentInstaller.java:89)
	at io.opentelemetry.javaagent.tooling.AgentInstaller.installComponentsBeforeByteBuddy(AgentInstaller.java:180)
	at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:114)
	at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:98)
	at com.microsoft.applicationinsights.agent.internal.wasbootstrap.MainEntryPoint.start(MainEntryPoint.java:82)
	at io.opentelemetry.javaagent.tooling.AgentInstallerOverride.installBytebuddyAgent(AgentInstallerOverride.java:11)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.opentelemetry.javaagent.bootstrap.AgentInitializer.startAgent(AgentInitializer.java:50)
	at io.opentelemetry.javaagent.bootstrap.AgentInitializer.initialize(AgentInitializer.java:30)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.opentelemetry.javaagent.OpenTelemetryAgent.premain(OpenTelemetryAgent.java:66)
	at com.microsoft.applicationinsights.agent.Agent.premain(Agent.java:41)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions