Configuring apm agent in kubernetes

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text :slight_smile:

TIP 1: select at least one tag that further categorizes your topic. For example server for APM Server related questions, java for questions regarding the Elastic APM Java agent, or ui for questions about the APM App within Kibana.

TIP 2: Check out the troubleshooting guide first. Not only will it help you to resolve common problems faster but it also explains in more detail which information we need before we can properly help you.

Kibana version: 8.12.2

Elasticsearch version: 8.12.2

APM Server version: 7.1

APM Agent language and version: java - 1.48 (

Browser version:

Original install method (e.g. download page, yum, deb, from source, etc.) and version: - need help in installation of apm agent for currenlt running kubernetes service in openshift

idea is to use apm agent in the form of init container and get the monitoring done

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant): - not able to configure the elastic agent using init container

Steps to reproduce:

Errors in browser console (if relevant): init crashloopbackoff

Provide logs and/or server output (if relevant):

apiVersion: apps/v1
kind: Deployment
name: my-service-init-test
namespace: backend
replicas: 1
app: my-service-init-test
app: my-service-init-test
- name: init-container
command: ['cp', '-v', '/usr/agent/elastic-apm-agent.jar', '/elastic/apm/agent']
- configMapRef:
name: my-apm-init-cm
- name: my-service
image: my-service-helm:9
- containerPort: 9600
- configMapRef:
name: my-service-cm
cpu: 500m
memory: 1Gi
cpu: 250m
memory: 500Mi
periodSeconds: 10
- name: my-docker-secret


I have very little knowledge about k8s, so you will have to provide a bit more context and details on the issue so we can help you here.

Do you have any logs on the container start and crash loop ? Did you also set the -javaagent command line argument for the JVM ?

I don't know what does an init container is, but the agent container is expected to be used as a "side car" container to provide the agent jar file, you are not expected to create your own application image directly on top of it.

Hello ,

Thanks for the reply.
let me explain about our cluster setup.

We are using openshift for deploying our services - which are mainly java based applications. we want to use elastic - APM for monitoring and we were suggested to deploy an elastic agent in the form of init conainer which will share the metrics to APM tool . I'm trying to do that, but its not working.

Update: work around was to put the "elastic-agent.jar" file inside our docker container and deploy it in openshift. its working

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.