Kubernetes
Give Go services their LogDrop settings 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: go is created, the injector mounts the ingest key and sets the LOGDROP_* settings and the pod's identity on your container. The LogDrop Go package in your service reads them at start. There is no init container and no agent image.
You need a service that starts the LogDrop Go package, a traces ingest key and the other items in Before you start. Java, Node.js, Python, .NET, Go, PHP and Rust services use the same chart, the same values and the same key Secret: if you already trace services in another language, upgrade the chart to 0.1.1-alpha15 and go to step 3.
1. Store the ingest key in each namespace you trace
The traces ingest key is the credential the package 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_KEYread -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 package 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.
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 UIDManaged 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.yamlWith these values the chart installs one small webhook pod, the trace injector, and nothing else; its runtime comes from registry.logdrop.io by digest (Verify what you install). Go needs no value of its own: go is always accepted. 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.
| Value | Default | Meaning |
|---|---|---|
tracing.endpoint | none | The traces endpoint, https://otel.logdrop.io: an HTTPS base URL without path, query or credentials |
tracing.namespaces | none | Namespaces whose annotated pods get settings. Pods in other namespaces are never sent to the webhook |
tracing.environment | production | Environment shown in APM |
tracing.serviceNamespace | empty | Default service group in APM. The pod annotation logdrop.io/service-namespace overrides it |
tracing.requirePodLabel | false | Also require the pod label logdrop.io/trace: go (or java, nodejs, python, dotnet, php, rust), so other pods in a traced namespace never reach the webhook. Recommended |
tracing.ingestKeySecret.name / .key | logdrop-trace-ingest-key / trace-ingest-key | The key Secret in each traced namespace |
tracing.caSecret / tracing.caSecretKey | empty / ca.crt | A Secret with a private CA. Only needed for an on-premises LogDrop installation with its own CA |
tracing.injector.timeoutSeconds | 5 | How long the API server waits for the injector. After that the pod is created without settings, so untraced |
tracing.injector.sourceCIDRs / sourcePeers | empty | Extra webhook callers besides networkPolicy.apiServerCIDRs |
tracing.injector.tls.existingSecret / caBundle | empty | Your 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.apiServerCIDRs | none | The API server addresses allowed to call the injector. Required while networkPolicy.enabled is true, the default |
clusterName, cluster.uid | empty | The 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 gives settings only to pods whose template carries the annotation logdrop.io/trace: go, 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: go # needed with requirePodLabel: true
annotations:
logdrop.io/trace: go
logdrop.io/service: orders # optional
logdrop.io/release: "1.4.2" # optional| Annotation | Meaning |
|---|---|
logdrop.io/trace: go | Opts the pod in. go, java, nodejs, python, dotnet, php and rust are supported; any other value is skipped with a status |
logdrop.io/service | Service name. Default: the label app.kubernetes.io/name, then the owning Deployment, StatefulSet, DaemonSet or Job, then the container name |
logdrop.io/service-namespace | Service group in APM. Default: tracing.serviceNamespace |
logdrop.io/release | Release shown in APM. Default: the label app.kubernetes.io/version |
logdrop.io/container | The container to give the settings to. Default: the first container |
logdrop.io/trace-status | Written 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 settings are added when a pod is created.
The annotation alone traces nothing: the service must call logdrop.Start (Add the package). A Go service without the package runs as before, with the settings unused.
4. Check it
Check that the injector gave the new pods their settings. 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 settings are in. The container log then shows one line from the package:
[logdrop-agent] INFO LogDrop Go agent 0.1.0-alpha2 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-status | Meaning |
|---|---|
injected | The settings were added |
skipped: unsupported language | The annotation value is not go, java, nodejs, python, dotnet, php or rust. On a go pod: the installed chart is older than 0.1.1-alpha13; upgrade it |
skipped: container not found | logdrop.io/container names no container of the pod |
skipped: no containers, skipped: invalid container name | The 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: volume name conflict, skipped: mount path conflict | The pod already uses the injector's volume name, or the path /var/run/secrets/logdrop.io/trace |
| missing | The 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 covers the network access tracing needs and the storage it uses in each traced pod. You need it when your cluster restricts traffic with NetworkPolicies.
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: go} # 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 package starts to log LogDrop is not reachable.
Disk. Tracing uses no node directories, no persistent volumes and no extra volume besides the key mount. The package keeps the spans waiting to be sent in memory (at most 2,048 by default) and drops new spans when that queue is full.
When the injector is unavailable
The webhook never blocks a deploy. When the injector is down, slow or unreachable, pods are created without settings, so untraced, and without a trace-status annotation; restart them once the injector is back. The injector never refuses a pod: a pod it cannot handle is created unchanged except for trace-status: skipped: <reason>.
Things to know
These points describe how the injected settings fit into your pods. Check them before you opt in production workloads.
LOGDROP_*variables that the container already sets win over the injected ones.- The package sends traces only. A service that sets up its own OpenTelemetry tracer provider keeps it, and the package stays off.
- Containers added by webhooks that run after the injector get no settings.
- 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. A new version of the package arrives with your next build (go get github.com/initialcodess/LogDrop-Go-Agent@<version>), not with the chart. helm rollback restores the previous webhook, configuration and certificate together.
helm uninstall removes the injector; running pods keep their settings until they restart, and restarted pods run untraced. To stop tracing one workload, remove the annotation and roll it out.
.png)