knowledge: kubelet resource metrics on embedded k8s; host-to-pod memory limit sizing#2
Open
dch0202-rsquare wants to merge 2 commits into
Conversation
…bedded k8s; host-to-pod memory limit sizing)
dch0202-rsquare
added a commit
to dch0202-rsquare/dev-loop
that referenced
this pull request
Jul 15, 2026
This was referenced Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Knowledge flush — 2 insight(s)
Decision Log
observability/logs-metrics-signals.md에 병합 → 배제: 그 페이지는 "내 서비스 계측"이 트리거고, 이 건은 "클러스터 메트릭 수집 소스 선택"이라 트리거가 다름(one case per page 규칙).resource-limits-and-probes.md가 이미 "OOMKilled + 측정 기반 리밋" 트리거를 소유 — 엣지케이스/Instead-of 행 병합이 중복 없는 형태.streaming-large-result-sets페이지로의related:링크 → 보류: PR knowledge: streaming large result sets (server-side cursor blocked → fetchmany + write-only) #1 미머지 상태라 main에 없는 페이지로의 링크는 깨질 수 있음(본문 Existing-layer check에 플래그).image!=""+cadvisorSelector, orbstack#1561), OrbStack 주장이 field-tested로 정직하게 표기됐는지,resource-limits-and-probes.md추가 2행이 기존 규칙 4("measure, don't copy")와 중복이 아닌 보강인지.Cross-Check: every mechanism claim was independently re-verified against primary
sources (chart values.yaml, kubernetes source, kubernetes-mixin source, psycopg2
docs) fetched live during this flush — not taken from the harvesting session.
Queue note: a third queued row (QueryPie streaming / fetchmany + write_only,
hash
637877dfc33bc0f0) was already flushed as PR #1 (open) but had notbeen removed from its session queue file; it was retired without re-ingesting.
Verified best-practice
Insight 1 — container_* metrics empty on OrbStack k8s despite kubelet targets up
Claim chain and verification:
with a stale default path.
Source:
charts/kube-prometheus-stack/values.yaml(prometheus-community/helm-charts,fetched live) —
resource: false,resourcePath: "/metrics/resource/v1alpha1",with the in-file comment "From kubernetes 1.18, /metrics/resource/v1alpha1
renamed to /metrics/resource". → verified
/metrics/resourceexposescontainer_cpu_usage_seconds_totalandcontainer_memory_working_set_byteswith labelscontainer, pod, namespaceonly — no
imagelabel.Source:
pkg/kubelet/metrics/collectors/resource_metrics.go(kubernetes/kubernetes,fetched live; both metrics STABLE). → verified
Source:
dashboards/resources/queries/pod.libsonnet(kubernetes-monitoring/kubernetes-mixin, fetched live) — memory queries select
cadvisorSelector(
metrics_path="/metrics/cadvisor") ANDimage!=""; the resource-endpointseries fail both. → verified
machine_*, zerocontainer_*, while the scrape reports success.First-hand probe (2026-07-14):
kubectl get --raw .../proxy/metrics/cadvisor→ 0
container_lines,machine_scrape_error 0;/metrics/resource→real working-set values. No official OrbStack doc states this; orbstack#1561
corroborates the metrics-integration gap. → field-tested (marked as such
in the page body; the page's other rows are verified).
Insight 2 — "ran fine on the host" is not evidence a pod memory limit fits
measurement. Already sourced on the existing page
(kubernetes.io manage-resources-containers). → verified (pre-existing)
client-side, so memory scales with data size; server-side cursors transfer
controlled amounts. Source: https://www.psycopg.org/docs/usage.html#server-side-cursors,
fetched live — "the Psycopg cursor usually fetches all the records returned
by the backend … a proportionally large amount of memory will be allocated
by the client" / "transfer to the client only a controlled amount of data".
→ verified
after 20 min; measured 1.5Gi+ peak once raised to 3Gi (mac-server k8s
migration, 2026-07-13). → field-tested context, used as the motivating
example only.
Existing-layer check
INDEX.md,infrastructure/index.md,infrastructure/containers/resource-limits-and-probes.md,infrastructure/observability/logs-metrics-signals.md; PR knowledge: streaming large result sets (server-side cursor blocked → fetchmany + write-only) #1's diff(
databases/query-optimization/streaming-large-result-sets.md) reviewed foroverlap with insight 2.
container metrics.
logs-metrics-signalsis about instrumenting your ownservice (different trigger) — not a duplicate. → new page,
related:linkedboth ways with
resource-limits-and-probes(its "set limits frommeasurement" rule depends on these very metrics) and one-way to
logs-metrics-signals.resource-limits-and-probes("pods OOMKilled") and same directive spirit ("measure, don't copy") → merged
into that page (1 edge-case row + 1 instead-of row + psycopg2 source), no new
page. The streaming fix itself lives in PR knowledge: streaming large result sets (server-side cursor blocked → fetchmany + write-only) #1's databases page; a
related:link to it was deliberately not added because that page is noton
mainyet (PR knowledge: streaming large result sets (server-side cursor blocked → fetchmany + write-only) #1 unmerged) — flagged here instead so the owner can addthe link when/if PR knowledge: streaming large result sets (server-side cursor blocked → fetchmany + write-only) #1 merges.
Routing decision
infrastructure/observability/container-metrics-when-cadvisor-is-empty.md(new page). Category
observabilityfits (metrics collection/sourceselection); no new category needed. Registered in
infrastructure/index.mdwith a load-when line keyed on "embedded/local k8s + container_* empty +
targets up";
log.mdingest entry appended.infrastructure/containers/resource-limits-and-probes.md(merge/revise, no new page). Category
containersalready owns theOOMKill/limit-sizing trigger.
last_verifiedbumped to 2026-07-14;log.mdrevise entry appended.