Last reviewed: November 12, 2026 (Asia/Shanghai); references checked November 11 UTC.

Direct answer

Control Kubernetes health check CometAPI costs by keeping model generation out of startup, liveness, and readiness handlers. Let those handlers observe application state without purchasing a completion. Schedule deliberate live model checks separately, with an explicit owner, route, interval, attempt ceiling, and shared financial allowance.

A GET /health request can still spend money if its handler internally sends a CometAPI request. Kubernetes does not know that the handler calls a model. Its probe reference describes periodic diagnostics performed by the kubelet against containers, with separate consequences for startup, liveness, and readiness. Replicating that handler replicates its upstream work.

Who this is for

This guide is for platform engineers and AI budget owners running a Kubernetes application that calls CometAPI for text generation. It addresses recurring monitoring spend, especially when each replica generates a sample answer to report itself healthy.

The configuration and acceptance checks below are recommendations. No cluster deployment, authenticated CometAPI request, or billing experiment was performed for this article. The cost example uses hypothetical rates. Match probe behavior to your cluster version and verify the selected model’s current billing contract before implementation.

Key takeaways

  • Trace the health handler into its dependencies; an HTTP method or route name does not establish that it avoids generation.
  • Forecast all replicas, probe types, environments, retries, and external monitors.
  • Treat configured cadence as a planning input, not an exact attempt ceiling.
  • Keep liveness tied to local recoverable failure; define serving requirements separately.
  • Budget live checks at their outbound dispatch point and preserve unresolved costs.
  • Verify zero model dispatch from local health handlers with a counted fake adapter.

Contract details to verify

Find every monitor that reaches generation

Inspect the rendered manifests and the implementation behind each probe path. Follow shared health libraries, dependency validators, initialization callbacks, and any fallback that generates when a saved result is absent. Include load-balancer checks and external uptime monitors that call the same route.

For each caller, record the environment, replica or checker count, probe type, interval, handler, and maximum upstream attempts per invocation. Trace retries inside the adapter too. A handler invoked once can still make several model attempts.

CometAPI’s Chat Completions reference documents POST /v1/chat/completions, its request controls, and returned usage. An application health handler that reaches that generation endpoint should enter the cost inventory as model traffic. Do not assume a special free health-check operation or billing exemption.

Calculate the recurring exposure

For a steady population and regular schedule, a useful nominal forecast is:

daily_handler_invocations = replicas × 86,400 × sum(1 / interval_seconds_p)
forecast_model_attempts = daily_handler_invocations × attempts_per_invocation
forecast_model_cost = forecast_model_attempts × estimated_cost_per_attempt

The sum covers each periodic probe class that reaches the spending handler. Calculate classes separately when they have different request shapes or retry policies. Count startup invocations during launches and restarts separately; they are not continuous periodic traffic after successful startup.

Suppose 24 replicas each have one liveness check and one readiness check every ten seconds. Assume every invocation makes one text-generation attempt, with no cache hits or retries, at a hypothetical average cost of $0.0005:

Planning scenarioNominal attempts per dayIllustrative model cost
24 replicas, two ten-second checks414,720$207.36
48 replicas, otherwise identical829,440$414.72
Separate live checker: four route-region combinations, each every five minutes1,152$0.576

These are arithmetic examples, not CometAPI prices or measured savings. The separate checker observes four selected paths; it does not prove that every application replica works. Application probes still run, with handlers that do not generate.

The Kubernetes reference says readiness checks may execute outside periodSeconds while a container is not Ready. Rollouts, restarts, variable replica counts, additional monitors, and internal retries also change actual traffic. A probe’s failureThreshold controls the failure decision; it does not cap lifetime model calls. Reconcile the forecast with outbound attempt records rather than promising a fixed daily count.

Give local probes precise meanings

Define the handler contract before editing its path:

HandlerExample application meaningModel dispatch allowed?
/health/startedRequired local initialization has completedNo
/health/liveThe application’s local progress detector is healthyNo
/health/readyThe instance currently satisfies its documented serving requirementsNo
Separate live checkerOne approved route accepts a bounded fixture and returns a parseable responseOnly after budget admission

Liveness should detect a condition for which restarting this container can help. The Kubernetes documentation warns that poorly implemented liveness can cause cascading failures. Restarting every replica does not repair an external model outage, and repeated startup checks can add more work if they also generate.

Readiness needs an honest serving contract. If the application can queue work or serve a permitted degraded result, define those conditions. If a model route is a strict dependency, readiness can consult bounded, recent dependency evidence maintained outside the handler. Specify how missing or stale evidence affects readiness. Reading that evidence must not trigger a refresh or generation on demand.

Also keep application spending admission visible. An instance with no permission to accept new work must follow its declared reject, queue, or degraded-service behavior. Removing generation from a probe is not a reason to report every instance ready unconditionally. Do not wire a live-check budget exhaustion directly into liveness or a restart loop.

Operator workflow

Point probes at implemented local handlers

This container fragment assumes an application health listener on port 8081 and the three handlers defined above. It is not a complete Deployment. Implement the handlers and their local progress checks before adopting the paths.

ports:
  - name: health
    containerPort: 8081
startupProbe:
  httpGet:
    path: /health/started
    port: health
  periodSeconds: 5
  timeoutSeconds: 1
  failureThreshold: 24
livenessProbe:
  httpGet:
    path: /health/live
    port: health
  periodSeconds: 10
  timeoutSeconds: 1
  failureThreshold: 3
readinessProbe:
  httpGet:
    path: /health/ready
    port: health
  periodSeconds: 10
  timeoutSeconds: 1
  failureThreshold: 2

The values are illustrative tolerances, not a universal health policy. A startup probe delays liveness and readiness probing until startup succeeds. Repeated startup or liveness failures can terminate the container under its restart policy; readiness failure leaves the container running while marking it unready.

Return a minimal direct status, such as 200 for the fixture’s healthy state and 503 for its unhealthy state. Kubernetes HTTP probes judge status codes from 200 through 399; they do not validate the generated answer in a response body. Check redirects and middleware as well as the handler. A model-generated paragraph supplies no useful additional evidence for that status check.

Admit deliberate live checks through one budget

Inventory the live observations you actually need: route, region or network path, credential scope, endpoint mode, and parser contract. Share a check only when those properties match. A centralized scheduler reduces duplicate work only if another scheduler, sidecar, or replica is not independently performing the same generation.

Give each check a fixed, non-sensitive fixture, a verified output limit, one completion choice, no tools, a finite deadline, and a maximum attempt count. CometAPI’s pre-call cost guide combines the exact model’s price with billable units and demonstrates max_completion_tokens. Verify the supported control for your chosen route. A short visible answer does not by itself bound all billable output, and the guide’s character-count heuristic remains an estimate.

Use the site’s atomic budget reservation workflow at dispatch. All checker workers share one allowance, or receive disjoint allocations whose sum fits it. Reserve a verified bound for the covered request before starting it. When such a bound is unavailable, describe the amount as a forecast and retain an explicit attempt ceiling rather than claiming a hard monetary cap.

Assign a durable identity to each scheduled check occurrence. Claim it once before dispatch so duplicate scheduler deliveries return existing state. Do not rely solely on a leader lease: a worker crash around transmission can leave an uncertain attempt. Resolve that identity before any replacement, and charge every permitted retry against the same monitoring policy. Disable hidden retries or include their maximum exposure explicitly.

Skip missed schedule occurrences after downtime; do not drain an obsolete backlog of health generations. Record skipped, disabled, or budget-denied checks as unavailable observations, not successful checks. Keep ordinary application probes running. If readiness depends on the live observation, apply its declared freshness rule without a refresh-on-read fallback.

Measure attempts and settle usage

Count health-handler invocations, approved live-check occurrences, actual adapter dispatches, and unresolved attempts independently. Record a monitoring workload identifier, route-configuration version, fixture version, attempt identity, price revision, reported usage, calculated cost, and settlement state. Keep credentials, prompts, and response content out of routine cost logs.

Use returned usage and actual billing evidence to reconcile estimates, as the CometAPI cost guide directs. After a timeout or lost response, retain unresolved exposure. A kubelet timeout or scheduler cancellation establishes a local observation; it does not establish that an upstream generation consumed nothing.

Report model cost per monitoring day together with the number and age of usable observations. A cheaper checker that produces no current evidence has not met its monitoring objective. Label forecast reductions separately from measured billing changes. The site’s CI cost guide applies the related separation between deterministic offline tests and deliberate paid checks; account for both workloads without merging their identities.

Smoke-test workflow

Use a disposable application environment, no usable live credential, and a counted fake model adapter. These are acceptance criteria to run, not reported results:

ScenarioRequired observation
Invoke each local health handler 100 timesCorrect local status; zero model-adapter dispatches
Mark the instance unready and repeat readiness checksZero dispatches, including any attempt to refresh dependency evidence
Increase replicas or restart the applicationLocal probes continue; no per-replica live-check scheduler appears
Deliver the same scheduled live-check identity twiceOne durable claim and at most one fake dispatch in the no-retry fixture
Exhaust the monitoring allowanceNo further live dispatch; an unavailable observation is recorded
Lose the fake response after dispatchOriginal attempt remains unresolved; no blind replacement
Advance past missed schedule occurrencesOld checks are skipped instead of replayed
Expire cached dependency evidenceReadiness follows its policy; liveness does not start generation or fail solely on that evidence

Trace the real composition path so the fake adapter counts every possible model call. Test middleware and shared health helpers too. Then approve one bounded live check separately to verify the selected route and usage handling. Reconcile that attempt before expanding the schedule.

Failure modes

The route is renamed but still generates. A new /ready path calls the old dependency helper. Inspect the call path and assert zero model dispatch.

Increasing periodSeconds is treated as a financial cap. Replicas, other callers, readiness behavior, and retries still affect spend. Remove generation from local probes and enforce the remaining live-check allowance.

A cached health result refreshes on every miss. Expiry turns many simultaneous reads into paid calls. Only the controlled checker may refresh; handlers return the defined stale or missing state.

Each replica receives the whole monitoring budget. Autoscaling multiplies the nominal allowance. Use shared admission or explicit partitions, and check the actual dispatcher count.

A timeout is booked as free. The remote request may have executed. Keep the attempt and its unresolved cost visible until evidence supports settlement.

Sources checked

Three primary public references were fetched successfully on November 11 UTC, November 12 in Asia/Shanghai:

These maintained official references support an evergreen operating task. They do not establish a current price, free monitoring entitlement, or incident. The budget design, arithmetic, handler contracts, and acceptance plan are recommendations derived from those interfaces.

FAQ

Does Kubernetes call CometAPI by itself?

The kubelet performs the configured diagnostic. Spending arises when your probe command, application handler, or one of its dependencies dispatches a model request. Trace that implementation before attributing cost.

Can readiness reflect an external model dependency?

Yes, when the serving contract requires it. Consult appropriately scoped, recent evidence without creating a generation on each read, and define the missing-evidence behavior. Keep the liveness decision about local recovery separate.

Is one cheap model enough for every live check?

A check observes the route it exercised. A cheap substitute can help test a shared transport path but cannot establish that another model, credential scope, endpoint mode, or parser works. Approve the coverage and cost together.

Does stopping live checks make monitoring free?

It stops new model attempts from that controlled checker. Kubernetes, observability, and infrastructure costs remain, and previously dispatched attempts still require reconciliation.

Reader next step

Choose one health handler that currently generates a sample answer. Count its callers and nominal daily exposure, replace its model call with the agreed local state check, and prove zero dispatch with the fake adapter.

Define the remaining live check’s scope, cadence, owner, and allowance. When those controls are ready, Start with CometAPI for one approved bounded check, then reconcile its attempt and usage before enabling recurrence.