Deploy OneAgent on Kubernetes for application-only monitoring
To deploy OneAgent on Kubernetes for application-only monitoring, read the instructions provided below.
Before you begin
You'll need to
- Acquire DESK environment credentials.
- Review the list of supported applications and versions.
Generate PaaS token
The first step is to get your environment ID and PaaS token for your DESK environment.
Integrate OneAgent into your application
The following steps explain how to integrate OneAgent with Kubernetes applications.
You have two integration options:
- Integrate at container build time.
- OneAgent v1.149 and later Integrate at container run time.
The build time integration consists of two steps:
- Integrate OneAgent to the application image.
- Build the application image.
Integrate OneAgent into the application image
Build your application image
Build the Docker image from your Dockerfile to use it in your Kubernetes environment:
$ docker build -t yourapp .
Note: You can monitor your application containers with a different DESK environment. To do this, read the instructions below:
To use this feature you need OneAgent version 149 or later.
With the container run time integration, OneAgent is made available to the application container via an initContainer
—your application image remains unaffected.
-
Extend your deployment template with
initContainer
, which will download OneAgent, and make it available as a volume. See the# initContainer to download OneAgent
and# Make OneAgent available as a volume
sections of the example below. -
In
DT_ONEAGENT_OPTIONS
set the OneAgent code module required for your application (TECHNOLOGY
). Valid options forflavor=default
areall
,java
,apache
,nginx
,nodejs
,dotnet
,php
, andgo
. You can specify several code modules, use the&include=<technology1>&include=<technology2>
syntax for that. Including specific technology-support options, rather than support for all technology options, results in a smaller OneAgent package.What if my Docker image is based on Alpine Linux?
DESK OneAgent supports the flavor
musl
for Alpine Linux based environments. Valid options forflavor=musl
areall
,java
,apache
,nginx
, andnodejs
. -
Add the newly created volume to the container of your application. Also add the
LD_PRELOAD
environment variable. See the# your application containers
section of the example below.
k8s-app-only-run-time.yaml
# your application containers
containers:
- name: customer-app
image: tomcat
env:
- name: LD_PRELOAD
value: /opt/desk/oneagent/agent/lib64/liboneagentproc.so
volumeMounts:
- mountPath: /opt/desk/oneagent
name: oneagent
# initContainer to download OneAgent
initContainers:
- name: install-oneagent
image: alpine:3.8
command:
- /bin/sh
args:
- -c
- ARCHIVE=$(mktemp) && wget -O $ARCHIVE "$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_PAAS_TOKEN&$DT_ONEAGENT_OPTIONS" && unzip -o -d /opt/desk/oneagent $ARCHIVE && rm -f $ARCHIVE
env:
- name: DT_API_URL
value: https://<Your-environment-ID>.live.desk.com/api
- name: DT_PAAS_TOKEN
value: <paastoken>
- name: DT_ONEAGENT_OPTIONS
value: flavor=<FLAVOR>&include=<TECHNOLOGY>
volumeMounts:
- mountPath: /opt/desk/oneagent
name: oneagent
# Make OneAgent available as a volume
volumes:
- name: oneagent
emptyDir: {}
Configure a proxy address (optional)
In case you run an environment with proxy, you need to set the DT_PROXY
environment variable in the application container to pass the proxy credentials to OneAgent.
Note: You might need to update the wget
shipped with the Alpine image to allow for proxy authentication for the download of OneAgent (see bugs.alpinelinux.org for more information).