Telegraf Kubernetes Restarts: Troubleshooting Probes

Brian Holt3 min read
Data AcquisitionOther ManufacturerTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Telegraf 1.12.6 was not crashing while writing to InfluxDB. The log shows a successful write followed by an orderly shutdown, while the Kubernetes Deployment used HTTP liveness and readiness probes with a 1-second timeout. Increasing the probe tolerance and timeout stopped the restarts.

Identify the shutdown mechanism

The webhook request completed its full data path: Telegraf accepted the Particle-format JSON, wrote one metric to InfluxDB, and made the data visible to the dashboard. The InfluxDB output reported a successful write in 4.584854 ms, with an empty buffer afterward.

Log evidence Engineering interpretation
[outputs.influxdb] Wrote batch of 1 metrics The database write completed successfully.
Buffer fullness: 0 / 10000 metrics No queued metrics remained at shutdown.
Stopping service inputs Telegraf entered its controlled stop sequence.
Hang on, flushing any cached metrics before shutdown The process was responding to a shutdown request rather than showing an abrupt failure.
Stopped Successfully The evidence does not show a Telegraf panic or failed InfluxDB write.

That timing alone does not prove which component initiated termination, but it directs the investigation toward external lifecycle management and health checks.

Check the Kubernetes probe configuration

The container exposed the Telegraf health output on port 8888. Kubernetes sent both liveness and readiness requests to / on that port with the following settings:

livenessProbe:
  failureThreshold: 3
  httpGet:
    path: /
    port: 8888
    scheme: HTTP
  periodSeconds: 10
  successThreshold: 1
  timeoutSeconds: 1

readinessProbe:
  failureThreshold: 3
  httpGet:
    path: /
    port: 8888
    scheme: HTTP
  periodSeconds: 10
  successThreshold: 1
  timeoutSeconds: 1

The confirmed resolution was to make these probes less aggressive by increasing the allowed successful attempts and increasing the timeout. The evidence does not provide the final numeric settings, so select them from measured health-endpoint response behavior instead of copying an unsupported value.

Review what the health endpoint evaluates

The health output listened on http://:8888 and evaluated buffer_size with two conditions:

[[outputs.health]]
  service_address = "http://:8888"

[[outputs.health.compares]]
  field = "buffer_size"
  lt = 5000.0

[[outputs.health.contains]]
  field = "buffer_size"

Both conditions must be true. Without metric filtering, the checks are not restricted to the InfluxDB writer series. One proposed correction was to scope health evaluation to the InfluxDB internal-write metric:

namepass = ["internal_write"]
tagpass = { output = ["influxdb"] }

This filtering requires the internal input to be enabled. Treat the broad health condition as a contributing hypothesis unless probe results confirm that the endpoint returned an unhealthy response during the write; the demonstrated fix was increased Kubernetes probe tolerance.

Apply the troubleshooting procedure

  1. Reproduce the issue with one POST and confirm whether InfluxDB logs a successful batch before shutdown.
  2. Distinguish an orderly stop from a crash. The sequence Stopping service inputs, cache flushing, output closure, and Stopped Successfully indicates controlled termination.
  3. Increase probe timeout and attempt tolerance. Do not change the webhook payload merely because the restart follows a POST; the same behavior occurred with both the Particle webhook and Python sender.
  4. If the health output should represent only InfluxDB writer health, enable the internal input and apply the supported namepass and tagpass filters.

Verify the correction

Send repeated webhook requests through port 1619 at path /particle. Verify that Telegraf continues listening, each batch reaches the telegraf database at http://influxdb.monitoring:8086, and Kubernetes does not restart the container. Also confirm that the health endpoint remains responsive through write activity and that the log no longer enters the controlled shutdown sequence after a POST.

FAQ

Why does Telegraf stop after a successful InfluxDB write?

In this case, Kubernetes health probes were too aggressive and triggered a container restart. The successful batch write followed by cache flushing and Stopped Successfully identifies an orderly shutdown rather than an InfluxDB write crash.

Which Kubernetes probe settings caused the Telegraf restarts?

Both probes ran every 10 seconds with failureThreshold: 3, successThreshold: 1, and timeoutSeconds: 1. Increasing the attempt tolerance and timeout resolved the restarts; the final values were not provided.

How do I restrict Telegraf health checks to the InfluxDB output?

Enable the internal input, then filter the health output with namepass = ["internal_write"] and tagpass = { output = ["influxdb"] }. This prevents the buffer_size conditions from evaluating unrelated series.

Back to blog