Skip to content

perf(k8s): Measure runner image pull and uv start #4616

Open

Description

@devops-cli-service

Update 2026-11-26 (infra move): the series allow list is now in dan-petty/infra.

  • includeMetrics is in helm/k8s-monitoring/values.yaml there, and homelab reads it at a release tag. Adding the series is the follow-up issue.
  • This issue keeps the runbook query and the measurement of the runner image layers and the first uv child.

Follow-up: dan-petty/infra#174.


Split from #4550.

The pull time, the uv start and the changed-layer size need a built image and live Jobs, so the offline suite cannot check them. The measurement waits on a release that carries the new layers, a node that holds the previous release, and 7 days of Jobs. Acceptance criteria: two image builds that differ only in src/ change less than 50 MB of layers together, measured by the sum of the differing layer sizes of docker history --no-trunc --format '{{.ID}} {{.Size}}'. A live runner Job on a node that holds the previous release starts its container in 10 s or less. After 7 days, the median from runner Job create to container start is 10 s or less, and the first uv child of an implement Job takes under 30 s. The measurement records the runner image growth, and the image stays under the 3000000000-byte bound of the smoke test.

Proposed design

Problem statement

The runner image pull and the first uv child have no recorded measurement. Prometheus holds no runner container start series, so the cluster cannot check the 10 s start target. The Loki measure to 2026-11-13 shows a p50 pull of 49.1 s, above the target. This change adds the kube-state-metrics series and the runbook queries. The live 7-day proof is deferred to a new issue.

Acceptance criteria

Requirement: Runner container start series

The kube-state-metrics metricsTuning.includeMetrics list in helm/k8s-monitoring/values.yaml of dan-petty/infra (follow-up issue) SHALL include kube_pod_container_state_started.

Scenario: The k8s validator accepts the metric allowlist

  • WHEN The k8s row of uv run devops ci --check --only k8s runs.
  • THEN The command exits 0 and the rendered kube-state-metrics configuration includes kube_pod_container_state_started.

Requirement: Runner start query

The Runner start entry of k8s/README.md SHALL give a PromQL query that uses kube_pod_container_state_started, kube_job_created and kube_pod_owner for the 7-day median and the 10 s target.

Scenario: The runbook query uses Job create and container start

  • WHEN A test reads the Runner start entry of k8s/README.md.
  • THEN The entry holds kube_pod_container_state_started, kube_job_created, kube_pod_owner, 7d and 10 s.

Requirement: Image pull source

The Runner start entry SHALL name the LogQL Pulled query of #5486 as the pull source and MUST NOT give a second pull query.

Scenario: The pull source is #5486

Requirement: First uv child

The Runner start entry SHALL give a kubectl logs command for the first uv child of an implement Job and the 30 s limit.

Scenario: The runbook gives the uv command

  • WHEN A test reads the Runner start entry of k8s/README.md.
  • THEN The entry holds a kubectl logs command for the implement Job and the 30 s limit.

Requirement: Layer and image size commands

The Runner start entry SHALL give the docker history --no-trunc --format '{{.ID}} {{.Size}}' command, 50 MB and 3000000000.

Scenario: The layer and size commands match the limits

  • WHEN A test reads the Runner start entry of k8s/README.md.
  • THEN The entry holds the docker history --no-trunc --format '{{.ID}} {{.Size}}' command, 50 MB and 3000000000.

Existing Tool Considered

No alternatives check has run. The open, maintained tool is kube-state-metrics (Apache-2.0). It already runs in the cluster and serves kube_pod_container_state_started and kube_pod_owner. The chart's default allowlist keeps kube_job.*. The tool only lacks the state metric in clusterMetrics.kube-state-metrics.metricsTuning.includeMetrics. Grafana Alloy ships the kubelet Pulled events to Loki. The LogQL query of #5486 reads the pull time. The kubelet kubelet_image_pull_duration_seconds histogram has no image label, so it cannot name the runner image. The Docker CLI gives the layer sizes and the image size.

The change builds no collector and no parser. It adds one allowlist entry, one README entry and one test. Its cost is about 50 lines of test, under 10,000 tokens and under one hour.

Key questions

  • Which source records the runner container start time?: kube-state-metrics. Add kube_pod_container_state_started to clusterMetrics.kube-state-metrics.metricsTuning.includeMetrics. The exporter already serves the metric. The current include list omits it, so no series exists today. (best practice) [sources: k8s/monitoring/k8s-monitoring-values.yaml, k8s/README.md]
    • Chosen: kube-state-metrics allowlist entry. The standard exporter already runs and serves the metric. One entry makes the series with no code to build or keep.
    • Rejected: Loki rule over the Started event. A Loki recording rule samples at each evaluation and carries the evaluation time. The cluster runs no Loki ruler.
    • Rejected: Custom runner metric. It changes the runner image and adds code to build, keep and fix.
  • Which source gives the runner image pull time?: The kubelet Pulled events through the LogQL metric query of feat(k8s): devops k8s logs runs LogQL metric queries #5486. The pipeline does not keep the kubelet histogram, and the histogram has no image label. This item adds no second pull query. (best practice) [sources: docs/guidelines/kubernetes.md, k8s/README.md]
    • Chosen: Pulled events through the query of feat(k8s): devops k8s logs runs LogQL metric queries #5486. It is the guideline fallback. Its event text names the image, and the 7-day measure already reads it.
    • Rejected: Kubelet image pull histogram. The pipeline does not keep it. It has no image label, so it cannot isolate the runner image.
    • Rejected: Custom collector. It adds code and duplicates the event data that Loki already holds.
  • Does the live 7-day measurement stay in this item?: No. Defer it to a new issue. The offline part adds the container start series and the runbook queries. The live proof waits on a release, a node with the previous release and 7 days of Jobs. (best practice) [sources: docs/guidelines/kubernetes.md, k8s/README.md]
    • Chosen: Defer the live proof to a new issue. The release and the 7-day window are outside events. The series and the runbook can reach Ready now.
    • Rejected: Keep the live proof in this item. It holds the allowlist change for a release and 7 days. The current measurement misses the target.
  • Which command measures the changed-layer size?: docker history --no-trunc --format '{{.ID}} {{.Size}}' for each layer size. Use the differing layer digests from docker image inspect, and sum only the layers whose digest differs. perf(k8s): put the dependencies in their own image layers #4550 measured 31.9 MB this way. (best practice) [sources: openspec/changes/archive/2026-11-11-4550-put-the-dependencies-in-their-own/design.md, docs/CLUSTER.md]
    • Chosen: docker history with docker image inspect. The CLI already builds the images and gives each layer size. perf(k8s): put the dependencies in their own image layers #4550 measured the change with it.
    • Rejected: dive. It adds a tool that the project does not pin or use.
    • Rejected: Registry manifest diff. It gives compressed sizes from a registry and not the local layer view. crane is not in tools.lock.
  • Where does the measurement runbook live?: In the Capacity targets section of k8s/README.md, in the Runner start entry. The entry already states the 10 s target. docs/K8S_PERFORMANCE.md no longer exists. The guideline applies to every project and holds no issue number, date or measured value. (best practice) [sources: k8s/README.md, docs/guidelines/kubernetes.md, tests/invariants/test_guidelines.py]
    • Chosen: k8s/README.md, Capacity targets. The environment tree README holds this cluster's decisions. It already states the Runner start target and may name the tracker and the issues.
    • Rejected: docs/guidelines/kubernetes.md. The guideline applies with no change to each managed project. Its invariant test rejects issue numbers, dates and measured values.
    • Rejected: docs/CLUSTER.md. It owns the runner image and Jobs, not the cluster capacity target. The start target lives in k8s/README.md.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5486

Activity

  1. added
    source/agent
    type/infra
    scope/k8s
    status/new
    value/medium
    effort/medium
    on Nov 11, 2026
  2. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    ContributorAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/infra. The perf prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium. The measurement validates the pull-time work but waits on a release and 7 days of Jobs.
    • Value: Medium. The numbers show if the new layers meet the 10 s start target and the 3 GB image bound.
    • Effort: Medium. It needs two image builds, a live node with the previous release, and 7 days of Job data.
    • Related: perf(k8s): put the dependencies in their own image layers #4550, which asks for a different change. Both items address runner image pull cost, but #4550 splits the dependency layers and the candidate measures the result after the release.
  3. changed the title [-]perf(k8s): measure runner image pull and uv start after dependency layers[/-] [+]perf(k8s): Measure runner image pull and uv start[/+] on Nov 11, 2026
  4. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    ContributorAuthor

    The job shortened the title of this item. The summary had 62 characters, and the limit is 60. The type and the scope stay.

    • Before: perf(k8s): measure runner image pull and uv start after dependency layers
    • After: perf(k8s): Measure runner image pull and uv start
    • Source of the summary: the background model
  5. dan-petty commented on Nov 13, 2026

    @dan-petty
    Owner

    Measure of 2026-11-13 and a metric need (from #5444)

    Kubelet Pulled events in Loki, 7 days to 2026-11-13 16:30 UTC: 28 pulls of the runner image (0.56 GB) for 47 runner pods. The pull took p50 49.1 s, p95 54.7 s and at most 58.2 s, and 27 of the 28 pulls took more than 10 s. So the median from Job create to container start is above the 10 s target of this issue before the uv start.

    Prometheus has no series for this measure today: kube-state-metrics gives no kube_pod_container_state_started or kube_pod_created for the runner pods, and the kubelet image pull histogram is not scraped. The only source is the Pulled event text in Loki, through a LogQL metric query (#5486).

    So the live proof of this issue needs one of these: keep the kubelet image pull histogram in the metric allowlist, record the container start time of the runner pods, or record the pull time from the events as a metric. docs/K8S_PERFORMANCE.md maps its gap "No metric of the image pull time" and its target T13 to this issue.

  6. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 0410772 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  7. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/k8ssource/agentstatus/newtype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions