Skip to main content
Back to blog

Cloudflare Worker to Kubernetes Origin Debugging: A Practical Edge Runbook

A practical runbook for debugging Cloudflare Workers, health checks, load balancers, and Kubernetes origins across startup and enterprise environments.

Edge bugs are hard because every layer can be technically correct in isolation.

The Worker runs. The DNS record exists. The origin is online. The Kubernetes Service has endpoints. The app logs look normal. Users still see 502s, timeouts, stale cache, or odd latency.

The problem is not that engineers lack tools. The problem is that edge, cloud, and Kubernetes context live in different places.

Clanker Cloud's job in this workflow is to bring the investigation together locally: Cloudflare context, Kubernetes state, recent deploys, and a reviewed plan before anyone changes production.

The Edge-To-Origin Path

Write the path down before debugging:

User
  -> Cloudflare DNS / routing / cache
  -> Worker or Pages Function
  -> fetch() or binding
  -> Load balancer or direct origin
  -> Kubernetes ingress
  -> Service
  -> EndpointSlice
  -> Pod
  -> downstream dependency

Then test each boundary.

If you skip the map, you end up tuning Kubernetes while the Worker is timing out on a subrequest, or debugging Workers while the Service has no endpoints.

What Cloudflare Gives You

Cloudflare Workers observability includes logs, real-time logs, Tail Workers, Logpush, traces, metrics, analytics, Query Builder, and export to OpenTelemetry-compatible destinations. Workers tracing gives request visibility across a Worker application and connected services, including fetch calls and binding operations.

Cloudflare Health Checks monitor whether an origin server is online from Cloudflare's edge network. Health Check analytics can help evaluate origin uptime, latency, failure reasons, and event logs.

Those are strong signals. They become more useful when correlated with Kubernetes and deploy history.

The Debugging Runbook

1. Classify The Failure

Start with the symptom:

  • Worker exception.
  • Worker timeout.
  • Origin 502.
  • Origin 522 or connection timeout.
  • Cache serving stale data.
  • Latency only from certain regions.
  • Health check failing while direct origin works.
  • Kubernetes ingress healthy but app failing.

The failure type tells you which boundary to inspect first.

2. Check Cloudflare Logs And Traces

Look for:

  • Worker exceptions.
  • Slow subrequests.
  • Failed fetch calls.
  • Binding errors.
  • CPU time or execution duration.
  • Request path patterns.
  • Region-specific behavior.
  • Cache status.
  • Response status from origin.

Ask Clanker Cloud:

Summarize Cloudflare Worker failures for this route and correlate them with origin health and Kubernetes rollout history.

The useful answer is not "probably Kubernetes." The useful answer says which request boundary failed.

3. Check Origin Health

Health checks tell you whether the origin is reachable and how it fails.

Validate:

  • Hostname and path.
  • Expected response code.
  • TLS behavior.
  • Headers required by the origin.
  • Regional failures.
  • Difference between health check path and real app path.
  • Whether a load balancer monitor differs from standalone health checks.

An origin can be "up" and still unable to serve the application path that users hit.

4. Check Kubernetes

Move inside the cluster:

  • Ingress controller events.
  • Service ports.
  • EndpointSlices.
  • Pod readiness.
  • Restart count.
  • NetworkPolicy.
  • Recent rollout.
  • Logs from the exact time window.

This is where Cloudflare and Kubernetes evidence need to meet. If the Worker logs show origin 502s after a deploy, Clanker Cloud should inspect the target ingress, Service, and Pod state in the same investigation.

5. Create A Reviewed Plan

Good plan:

Finding: Worker fetch to /api/upload times out after the latest api rollout.
Evidence: Cloudflare trace duration, origin health path success, Kubernetes EndpointSlice present, pod readiness failing for upload route.
Action: rollback api deployment or patch readiness route after owner review.
Risk: upload path unavailable for active customers.
Rollback: restore previous deployment revision.

Bad plan:

Purge cache and restart pods.

That might clear the symptom. It does not explain the system.

Startup Version

For small teams:

  • Keep one clear route from Worker to origin.
  • Use a dedicated health path that tests real dependencies when needed.
  • Add deploy markers.
  • Keep Kubernetes labels consistent.
  • Use Clanker Cloud when the issue crosses Cloudflare and the cluster.

Enterprise Version

For platform teams:

  • Standardize origin health check paths.
  • Track Worker deployments and Kubernetes rollouts together.
  • Export traces and logs to the existing observability stack.
  • Require reviewed plans for edge routing, cache, and ingress changes.
  • Attach evidence to incident tickets.

The Takeaway

Cloudflare plus Kubernetes is powerful, but it creates a cross-boundary debugging problem.

Native Cloudflare observability tells you what happened at the edge. Kubernetes tells you what happened in the cluster. Clanker Cloud should connect those views locally and turn them into a safe, reviewed plan.

Sources

Next step

Ask Clanker Cloud what your cluster is doing

Install the local app, connect your kubeconfig, and turn cluster state, workload health, cost context, and safe next steps into one readable answer.

Download Clanker CloudOpen the Cloudflare and EKS example