LogDrop
Backend TracingJava

Kubernetes

Add the LogDrop Java agent to your pods with the LogDrop Helm chart and one pod annotation.

The LogDrop Helm chart installs a small admission webhook, the trace injector. When a pod whose template carries the annotation logdrop.io/trace: java is created, the injector adds an init container that copies the LogDrop Java agent into the pod and sets JAVA_TOOL_OPTIONS and the LOGDROP_* settings on your container. Your images and code stay unchanged.

You need a traces ingest key and the other items in Before you start, and the Java requirements.

1. Store the ingest key in each namespace you trace

The traces ingest key is the credential the agent sends traces to LogDrop with. On Kubernetes it lives in a Secret named logdrop-trace-ingest-key in each traced namespace. Create the Secret with:

printf 'Traces key (paste it once, then press Enter): ' && read -rs LOGDROP_TRACE_KEY && echo
if [[ $LOGDROP_TRACE_KEY == ldtk_* && ${#LOGDROP_TRACE_KEY} -eq 71 ]]; then
  kubectl -n <namespace> create secret generic logdrop-trace-ingest-key \
    --from-literal=trace-ingest-key="$LOGDROP_TRACE_KEY"
else
  echo 'That is not one traces key (it starts with ldtk_ and has 71 characters). Paste it once.'
fi
unset LOGDROP_TRACE_KEY

read -rs keeps the key out of your shell history and off the screen, so nothing appears while you paste: paste once. The check refuses a key pasted twice or cut short; LogDrop answers such a key with 401. The commands work in bash and zsh. The Secret must exist in every traced namespace; the chart never creates it. A pod in a namespace without the Secret still starts, but sends nothing (its log says LogDrop ingest key file is missing or invalid).

The key never appears in pod specs or logs: the injector mounts the Secret as a read-only file and the agent reads it from there. With a GitOps tool, keep the Secret in your usual secret workflow (for example Sealed Secrets, External Secrets or SOPS), never as plain text in Git.

2. Install the LogDrop chart with tracing on

The LogDrop Helm chart installs the trace injector in your cluster. The values below turn tracing on and set where traces go, which namespaces are traced and the environment shown in APM.

logdrop-values.yaml
enabled: true
clusterName: <a name for this cluster, for example shop-prod>
cluster:
  uid: <kube-system namespace UID>     # optional; adds the cluster identity to every trace
tracing:
  enabled: true
  endpoint: https://otel.logdrop.io
  namespaces: [<namespace>]           # every namespace whose pods you want to trace
  environment: production
  requirePodLabel: true               # only labelled pods ever reach the injector
networkPolicy:
  apiServerCIDRs: [<API server address>/32]

Find the API server addresses and the cluster UID with:

kubectl get endpointslices -n default -l kubernetes.io/service-name=kubernetes \
  -o jsonpath='{.items[*].endpoints[*].addresses[*]}'                          # API server addresses
kubectl get namespace kube-system -o jsonpath='{.metadata.uid}'                # cluster UID

Managed control planes that call webhooks through an in-cluster proxy also need that proxy as a source. On DigitalOcean Kubernetes, for example, the calls come from the konnectivity agents:

tracing:
  injector:
    sourcePeers:
      - namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: kube-system}}
        podSelector: {matchLabels: {k8s-app: konnectivity-agent}}

Install the chart:

helm upgrade --install logdrop oci://registry.logdrop.io/charts/logdrop-infrastructure --version 0.1.1-alpha15 \
  --namespace logdrop-system --create-namespace -f logdrop-values.yaml

The chart pulls the agent image (registry.logdrop.io/logdrop-javaagent) and the injector's runtime from registry.logdrop.io by digest; see Verify what you install. With these values it installs one small webhook pod, the trace injector, and nothing else. The same chart also installs the infrastructure metrics agent, which links each trace to its cluster and pod: add its values to this release (Infrastructure Monitoring).

On DigitalOcean Kubernetes with Helm 4, a later helm upgrade can stop with a conflict on the injector webhook's objectSelector, because the platform adds its own rule there. Run the upgrade again with --server-side=true --force-conflicts.

ValueDefaultMeaning
tracing.endpointnoneThe traces endpoint, https://otel.logdrop.io: an HTTPS base URL without path, query or credentials
tracing.namespacesnoneNamespaces whose annotated pods are instrumented. Pods in other namespaces are never sent to the webhook
tracing.environmentproductionEnvironment shown in APM
tracing.serviceNamespaceemptyDefault service group in APM. The pod annotation logdrop.io/service-namespace overrides it
tracing.requirePodLabelfalseAlso require the pod label logdrop.io/trace: java (or nodejs, python, dotnet, go, php, rust), so other pods in a traced namespace never reach the webhook. Recommended
tracing.ingestKeySecret.name / .keylogdrop-trace-ingest-key / trace-ingest-keyThe key Secret in each traced namespace
tracing.caSecret / tracing.caSecretKeyempty / ca.crtA Secret with a private CA. Only needed for an on-premises LogDrop installation with its own CA
tracing.java.imageLogDrop's published agent, by digestSet your own repository and digest (or tag) when you mirror images
tracing.java.imagePullSecretsemptyPull Secrets for the agent image. They must exist in every traced namespace
tracing.java.resourcesrequests 10m / 16Mi, limits 100m / 64MiThe init container that copies the agent. Your container keeps its own resources
tracing.injector.timeoutSeconds5How long the API server waits for the injector. After that the pod is created without tracing
tracing.injector.sourceCIDRs / sourcePeersemptyExtra webhook callers besides networkPolicy.apiServerCIDRs
tracing.injector.tls.existingSecret / caBundleemptyYour own webhook certificate (for example from cert-manager) and the CA that signed it. Empty: the chart generates one, reuses it on upgrades and renews it 60 days before it expires
networkPolicy.apiServerCIDRsnoneThe API server addresses allowed to call the injector. Required while networkPolicy.enabled is true, the default
clusterName, cluster.uidemptyThe cluster name and UID added to every trace

With Argo CD or helm template (no cluster access while rendering), the generated webhook certificate changes on every render. Give the chart a certificate with tracing.injector.tls.existingSecret and the CA that signed it in tracing.injector.tls.caBundle.

3. Opt a workload in

A pod annotation is a key and value in a pod's metadata. The injector adds the agent only to pods whose template carries the annotation logdrop.io/trace: java, so you choose which workloads are traced.

Add the label and the annotations to the pod template and roll the workload:

spec:
  template:
    metadata:
      labels:
        logdrop.io/trace: java                # needed with requirePodLabel: true
      annotations:
        logdrop.io/trace: java
        logdrop.io/service: orders            # optional
        logdrop.io/release: "1.4.2"           # optional
AnnotationMeaning
logdrop.io/trace: javaOpts the pod in. java, nodejs, python, dotnet, go, php and rust are supported; any other value is skipped with a status
logdrop.io/serviceService name. Default: the label app.kubernetes.io/name, then the owning Deployment, StatefulSet, DaemonSet or Job, then the container name
logdrop.io/service-namespaceService group in APM. Default: tracing.serviceNamespace
logdrop.io/releaseRelease shown in APM. Default: the label app.kubernetes.io/version
logdrop.io/containerThe container to trace. Default: the first container
logdrop.io/trace-statusWritten by the injector: injected or skipped: <reason>

Annotation values are at most 128 characters, without control characters. Pods that already run are not changed: the agent is added when a pod is created.

4. Check it

Check that the injector added the agent to the new pods. It records the result in the pod annotation logdrop.io/trace-status:

kubectl -n <namespace> get pod <pod> -o jsonpath='{.metadata.annotations.logdrop\.io/trace-status}'

injected means the agent is in. The container log then shows one line from the agent:

[logdrop-agent] INFO LogDrop Java agent 0.1.0-alpha5 is tracing service "orders" (environment "production") to otel.logdrop.io.

Send a request to the service. The trace appears in Trace Explorer within about a minute; the service, its endpoints and dependencies appear in Services and the Dependency map within about two minutes. See Tracing & APM.

trace-statusMeaning
injectedThe agent was added
skipped: unsupported languageThe annotation value is not java, nodejs, python, dotnet, go, php or rust
skipped: container not foundlogdrop.io/container names no container of the pod
skipped: no containers, skipped: invalid container nameThe pod spec cannot be instrumented
skipped: invalid logdrop.io/service (or service-namespace, release)The annotation value is empty, longer than 128 characters or has control characters
skipped: JAVA_TOOL_OPTIONS uses valueFromThe container takes JAVA_TOOL_OPTIONS from a ConfigMap or Secret, which the injector never rewrites. Set it as a literal value
skipped: volume name conflict, skipped: mount path conflictThe pod already uses the injector's volume names, or the paths /logdrop-agent or /var/run/secrets/logdrop.io/trace
missingThe webhook did not see the pod: its namespace is not in tracing.namespaces, the pod label is missing with requirePodLabel: true, the pod was created before the chart was installed, or the injector was unavailable

Network and disk

This section lists the network access the injector and the traced pods need, and the storage tracing uses in each pod. Check it when your cluster restricts network traffic, or when pods get no trace-status annotation.

The injector runs in the pod network. The chart gives it a NetworkPolicy that admits only the API server addresses in networkPolicy.apiServerCIDRs, plus tracing.injector.sourceCIDRs and sourcePeers, on the webhook port, and allows it no egress. It has no access to the Kubernetes API. If pods are created without a logdrop.io/trace-status annotation after you install the chart, the control plane probably reaches the webhook from an address you have not listed.

Traced pods send to the traces endpoint on port 443 and need DNS. In namespaces with a default-deny egress policy, allow it:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: {name: allow-logdrop-trace-export, namespace: <namespace>}
spec:
  podSelector:
    matchLabels: {logdrop.io/trace: java}   # without the pod label: podSelector: {}
  policyTypes: [Egress]
  egress:
    - to: [{ipBlock: {cidr: <traces endpoint address>/32}}]
      ports: [{protocol: TCP, port: 443}]

A NetworkPolicy matches IP addresses, not host names. Allow the addresses that otel.logdrop.io resolves to, and check them again if the agent starts to log LogDrop is not reachable.

Disk. Tracing uses no node directories and no persistent volumes. The agent keeps the spans waiting to be sent in memory (at most 2,048 by default) and drops new spans when that queue is full. Each traced pod gets an emptyDir volume, limited to 64 MiB, that holds the agent jar of about 25 MB.

When the injector is unavailable

The webhook never blocks a deploy. When the injector is down, slow or unreachable, pods are created without tracing and without a trace-status annotation; restart them once the injector is back. The injector never refuses a pod: a pod it cannot instrument is created unchanged except for trace-status: skipped: <reason>.

Things to know

These points describe how the injected agent fits into your pods. Check them before you opt production workloads in.

  • JAVA_TOOL_OPTIONS set in the image (ENV in a Dockerfile) is replaced by the pod-level value the injector adds. Move such options into the pod spec, where the injector appends -javaagent to them. A value from envFrom is overridden the same way.
  • Size the container for about 100 MiB more memory and about one second more startup time with the agent.
  • LOGDROP_* variables that the container already sets win over the injected ones.
  • Containers added by webhooks that run after the injector are not instrumented.
  • The webhook receives the full spec of every pod created in the traced namespaces (with requirePodLabel: true, only of labelled pods). Its logs carry only the pod name, the namespace and the result, never environment values.

Upgrade, roll back, remove

helm upgrade keeps the webhook certificate and restarts the injector when its configuration changes. Running pods keep the agent they started with until they are restarted, so roll your workloads to pick up a new agent version. helm rollback restores the previous webhook, configuration and certificate together.

helm uninstall removes the injector; instrumented pods keep their copy of the agent until they restart. To stop tracing one workload, remove the annotation and roll it out.

On this page