A one-line move off Kubernetes, reverted twenty minutes later
The commit that leaves Kubernetes and the commit that comes back are twenty minutes apart, and the real change was in Vault.
The service is small enough to describe exactly (one Python module, 23 lines). It wraps the open-source query-exporter,
which runs SQL against a Postgres read replica and publishes the results as Prometheus gauges.
My addition to it is 23 lines of Python:
class HealthQueryExporterScript(QueryExporterScript):
async def on_application_startup(self, application: Application):
application.router.add_get("/health", self._handle_health)
await super().on_application_startup(application)
async def _handle_health(self, request: Request) -> Response:
return json_response({"status": "OK"})
That endpoint exists because the deployment platform needs something to poll. Everything else here
is configuration — three YAML files (databases.yaml, queries.yaml, metrics.yaml) and a deploy
descriptor. The descriptor asked for 32 MiB of memory, a 64 MiB limit and 100 millicores; it also
set instances: 1, strategy: simple and auto_revert: no.
The evening of 2 September
The sequence in the log, in order, over about two hours (all IST):
19:50 Update the prod k8s clusters
20:22 remove site-a from deployment of pods
20:46 moved to cipipeline for deployment [instead of kubernetes]
21:06 re-add site-a in k8s after adding secrets in vault
21:24 Add secrets from env
22:07 add read env from file and remove manual secrets definition
22:55 revert to secrets from env
The middle commit is the one the title of this post would have you believe in. It is one line:
@Library("…/infra-ci-pipelines@latest") _
-kubernetes {
+ciPipeline {
service = "wireless-query-exporter"
}
Twenty minutes later it went back, and the commit message says why ("after adding secrets in vault"). The pod was not failing because Kubernetes was the wrong shape for the workload. It was failing because the Postgres credentials were absent from Vault for the second cluster (site-a, added that evening). Switching the deployment model is the kind of fix that looks adjacent to the problem while touching none of it. The thing that actually changed was six Vault paths mapped to environment variables:
secrets:
vault: |
…/postgres-wireless/wireless_manager username | WIRELESS_USER;
…/postgres-wireless/wireless_manager password | WIRELESS_PASSWORD;
…/postgres-wireless/wireless_manager replica_host | WIRELESS_HOST;
The two commits after that are the same mistake in miniature. secrets_from: env became
secrets_from: file, the explicit four-name secret: list was deleted, and then file became
env again at 22:55. Nothing was learned in between — only which of the two the platform
supports for this service.
What the real decision was
It came the next day, under CW-2659, as two one-line diffs (prod first, dev after). k8s_clusters in production
went from ["backend-site-a-prod", "backend-site-b-prod"] to ["backend-site-a-prod"], and dev
followed a few hours later. The commit message is the whole argument: not a critical service -
1 replica is enough.
That is defensible here for a reason specific to what the service does. Its headline metric
(wireless_available_sim_card_public_ips) feeds exactly one alert:
min(wireless_available_sim_card_public_ips{app="query-exporter"}) by (region) < 20
Fewer than twenty spare public IPs in a region means provision more ranges — a deadline measured in days. An exporter down for ten minutes loses ten minutes of samples from a slow gauge, and nothing downstream notices. A second replica buys redundancy for a number nobody reads in real time; it also costs a second set of credentials in a second cluster, which is precisely what had broken the night before.
The gap that was still open
Queries and metrics are declared in separate files (queries.yaml, metrics.yaml) and have to
agree by name. Nothing checked that. Rename a query without renaming its metric and the exporter starts cleanly, scrapes
cleanly, and exports nothing — the alert above then evaluates against an empty vector and stays
silent, which reads as "plenty of IPs". CW-2860 added validate_config.py (335 lines) to fail the
build on a mismatch instead of discovering it when a region runs dry.
What is left of it now
Almost none of the deployment configuration I argued about survives. A colleague migrated the
repository from Jenkins to GitHub Actions in August 2026, and the entire deploy: block left
meta-prod.yml with it — no k8s_clusters, no instances, no strategy. What remains is three
blocks — the Vault mapping, promote_to_prod: mode: always, and a dependency line naming the
Postgres replica.
So the honest version of this post is not a migration story. One line switched the deployment model and one switched it back; the credentials were the fault throughout. The only durable decision was one replica in one datacentre, because a gauge that moves in days does not earn two.