Site24x7 APM Insight Java agent setup in K8s via Persistent Volumes
This document explains how to setup the APM Insight Java agent for applications running in Kubernetes via persistent volumes.
Prerequisites
- A persistent volume (with a capacity of 100mb).
- The persistent volume mounted on all deployment pods (via persistent volume claim).
- The Site24x7 APM Insight Java agent zip file was downloaded, moved and extracted to this volume.
Note: You can download the agent zip file from this link. - Add the Site24x7 license key (copied from our web client) to the apminsight.conf file, if you wish to keep it as a secret, skip this step.
- If there is any proxy connection, provide the proxy details in the apminsight.conf file.
Instructions
If you have provided the Site24x7 license key in the apminsight.conf file, you can skip this step. Otherwise, include it in the application secrets file.
Example

kubectl create secret generic app-secret --from-literal=s247licensekey='your_s247_license_key' -n petclinic
Replace app-secret, s247_license_key, and namespace petclinic with the appropriate values.
- You must include the following two environment variables in the application deployment YAML file as shown.
- If the license key is provided in the apminsight.conf file, ignore this step.
Name: S247_LICENSE_KEY
Value: s247licensekey from the secret added in step 1. - Name: JAVA_TOOL_OPTIONS
Value: "-javaagent:[mount/path]/apminsight-javaagent.jar -Dapminsight.application.name=[DesiredMonitorName] -apminsight.log.dir=/home/apm"
In this step, we configure the arguments that the application (Java process) will use during startup, and the agent to report data to the specified monitor name and agent logs to be written to the path /home/apm.
Example
env:
- name: S247_LICENSE_KEY
valueFrom:
secretKeyRef:
name: app-secret
key: s247licensekey
- name: JAVA_TOOL_OPTIONS
value: "-javaagent:/opt/apm/apminsight-javaagent.jar -Dapminsight.application.name=Petclinic -Dapminsight.log.dir=/home/apm"
- If the agent jar file (apminsight-javaagent.jar) is not available during application startup, the pod creation will fail.
- The agent update must be done manually with this method.
Sample Kubernetes Deployment YAML file

apiVersion: v1
kind: Namespace
metadata:
name: petclinic
---
apiVersion: v1
kind: PersistentVolume
metadata:
namespace: petclinic
name: agent-storage
spec:
capacity:
storage: 50Mi
storageClassName: standard
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: "/opt/apm"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: petclinic
name: agent-pvc
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Mi
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: petclinic
name: petclinic-deployment
spec:
replicas: 2
selector:
matchLabels:
app: petclinic
template:
metadata:
labels:
app: petclinic
spec:
volumes:
- name: agent
persistentVolumeClaim:
claimName: agent-pvc
containers:
- name: petclinic
image: petclinic:2.5
ports:
- containerPort: 8080
volumeMounts:
- name: agent
mountPath: /opt/apm/
env:
- name: S247_LICENSE_KEY
valueFrom:
secretKeyRef:
name: app-secrets
key: s247license
- name: JAVA_TOOL_OPTIONS
value: "-javaagent:/opt/apm/apminsight-javaagent.jar -Dapminsight.application.name=Petclinic -Dapminsight.log.dir=/home/apm"
Related Articles
How to add APM Insight Java agent without application restart?
In general, after installing the APM Insight Java agent, you have to restart your application for the agent to capture monitoring data. But in case of critical issues in the app, like sudden application slowness, where you haven't installed APM ...
How to upgrade the APM Insight Java agent to the latest version that supports Java 6 and 7?
Java agent version 5.7.0 and above deprecates support for Java applications running on Java 6 and 7. Please see this community post for more details. If you don't want to upgrade to Java 8, you can stick with Java 6 or 7. Since Java agent version ...
How to rename an APM Insight application?
Site24x7 APM Insight doesn't support renaming applications/monitors from the web client. However, the application name of an existing application instance can be renamed in the apminsight.conf file and the agent associated with that instance will ...
What does Java agent troubleshooting operation do and what are the additional arguments that can be given?
Troubleshooting operation will perform the below mentioned checks: Checks whether agent directory has read/write operations Checks whether apminsight.conf has license key mentioned Checks whether agent state, unmanaged, deleted or managed Checks ...
Steps to troubleshoot when you get NO DATA message for Java applications.
After adding APM Insight Java agent, if you get NO DATA message, it could be because of probable reasons like network issues or zero traffic in your application. Kindly read through the below given instructions to troubleshoot. Reason Cause Solution ...