doc.overops.com

JVM in a Kubernetes Container

If you're attaching the OverOps Micro-Agent to an environment that's running Java 10 or 11 or any IBM Java version, please follow these guidelines:

When attaching an OverOps Agent to a JVM that is running Java 10 or 11 or any IBM java versions, follow these guidelines:

  1. Turn off Class Sharing: This can be done using the following flags:
    for IBM Java
    ‑Xshareclasses:none
    for HotSpot
    -Xshare:off -XX:-UseTypeSpeculation

  2. Increase ReservedCodeCache to at least 512mb by adding the following flag
    -XX:ReservedCodeCacheSize=512m

  3. The Agent should appear last in the VM arguments list before specifying the main class or jar.

  4. When adding/removing 3rd party packages, the Agent should be restarted.

Additionally, if you wish to upgrade your own compiler to target Java 10/11, then you'll have to upgrade your Collector (SaaS) or Collector + backend (On-Premises) to support it.

AIX - Statistic Overhead and Performance

When running on an AIX system please add the following parameter to reduce the Statistics Overhead and increase performance
-Dtakipi.neo.heapless.inst.pre.vm=path/to/java-executable
Details can be found in the Micro-Agent Properties

For example path: ../jre/bin/java binary

Agent Ranking

Make sure that the OverOps Micro-Agent is the last -agentlib or -agentpath argument in your argument list if you are using any other agents with your application in addition to OverOps.

Attaching the OverOps Micro-Agent to Containers in Kubernetes

The OverOps Micro-Agent library can be made available to a container through a Persistent Volume or by copying it directly into an image.

Set environment variables to configure the Agent to connect to the Collector and to attach the Micro-Agent to all running JVMs inside the container.

TAKIPI_COLLECTOR_HOST=collector
TAKIPI_COLLECTOR_PORT=6060
JAVA_TOOL_OPTIONS=-agentpath:/takipi/lib/libTakipiAgent.so

Note

If you're running more than one JVM inside a container and you do not want OverOps to monitor all of them, you'll need to modify the command used to start your JVM.

Instead of setting the JAVA_TOOL_OPTIONS environment variable, start your JVM with
-agentpath:/takipi/lib/libTakipiAgent.so before the -jar and -cp arguments.

Tip

For best results, name your applications and deployments at the JVM level.
see Naming the Application, Server, Deployment for details.

Agent Ranking

Make sure that the OverOps agent is the last -agentlib or -agentpath argument in your argument list if you are using any other agents with your application in addition to OverOps.

Note

Verify that the -Dtakipi.* JVM arguments are located before the -jar and -cp arguments.

The OverOps Micro-Agent is a native agent and is OS-specific. If using an:

  • Alpine Linux based image, use the Alpine Agent
  • Red Hat and Debian based images, use the Standard Agent.

Persistent Volume

The Micro-Agent can be stored on a persistent volume and mounted into a container at runtime by adding the following to your pod or deployment controller's container spec, modified to use your volume:

  env:
    - name: TAKIPI_COLLECTOR_HOST
        value: "overops-collector-service"
    - name: TAKIPI_COLLECTOR_PORT
        value: "6060"
    - name: TAKIPI_RESOURCES_DIR
        value: "/tmp"
    - name: JAVA_TOOL_OPTIONS
        value: "-agentpath:/takipi/lib/libTakipiAgent.so"
  volumeMounts:
    - mountPath: /takipi
        name: takipi-volume
  volumes:
    - name: takipi-volume

Download and unzip the latest Micro-Agent to create a takipi folder on the Persistent Volume.

For Red Hat / Debian based images: https://s3.amazonaws.com/app-takipi-com/deploy/linux/takipi-agent-latest.tar.gz

For Alpine Linux based images (beta): https://s3.amazonaws.com/app-takipi-com/deploy/alpine/takipi-agent-latest.tar.gz

Note

If you're sharing the same Agent through a mount across multiple containers, set the environment variable TAKIPI_RESOURCES_DIR=/tmp to avoid conflicts and to ensure each Agent writes to its own folder.

Copy

To copy the Micro-Agent into your image, add the following lines to your Dockerfile:

# set default environmental variables
ENV TAKIPI_COLLECTOR_HOST=collector
ENV TAKIPI_COLLECTOR_PORT=6060
ENV JAVA_TOOL_OPTIONS=-agentpath:/takipi/lib/libTakipiAgent.so

# Download and install the agent - extracts into the `takipi` folder.
# NOTE: Use the correct Agent for your OS
RUN curl -sL https://s3.amazonaws.com/app-takipi-com/deploy/linux/takipi-agent-latest.tar.gz | tar -xvzf -

Pod Preset

Tip

Mounting the Agent into a container at runtime is the preferred approach.

By leveraging Pod Presets, the environment variables and volume mount method used above can be easily scaled across many pods without significant changes to existing pod or deployment configurations.

Note

Pod Presets are currently an alpha-level feature of Kubernetes.
The feature must be first be enabled in your cluster before applying the preset.

After enabling Pod Presets, create a preset for the Agent.
There are two examples available below:

  • this pod-preset assume the persistent mount already exists --> pod-preset.yaml
  • this pod-preset will additionally create and build the persistent mount to be used --> agent-pod-preset.yaml

both are available on GitHub.

Now apply the configuration:

kubectl apply -f pod-preset.yaml

With the preset in place, simply add the label takipi: inject-agent to pods and deployments you wish to monitor with OverOps.

Verify

Confirm connectivity by going to https://app.overops.com (see Verifying the Connection for details).

Next Steps

Naming your Application, Server, Deployment

  • Option 1: Using JVM arguments passed at application start-up
  • Option 2: Using JAR or WAR manifest attributes

Updated 7 months ago

JVM in a Kubernetes Container


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.