Workload operations and analysis tools
Workload operations and analysis tools help an engineer move from a resource row to the evidence, state, and actions needed to understand a Kubernetes workload. They connect workload and pod views with container details, logs, events, timelines, resource documents, safe operational changes, capacity advice, and persistent-volume access. This page is a child of Cluster operations and analysis and relates to Fleet, GitOps, and Argo CD integration.
Workload inspection surface
The inspection surface turns a selected workload into a focused view of its pods and containers. Each view keeps the selected object as the anchor while allowing the engineer to move to the next layer of evidence.
flowchart LR
A[Workload or service] --> B[Matching pods]
B --> C[Containers]
B --> D[Logs]
A --> E[Health explanation]
A --> F[Resource details and events]
A --> G[State-change timeline]
Workload and container context
Drill-down navigation follows the useful ownership path for common workload types. A workload or service opens its matching pods, and a pod opens a container view that shows readiness, state, restarts, image, ports, probes, resource values, and available container metrics. This context links a high-level workload symptom to the container that may cause it.
References: src/…/containers.rs• L3-11 src/…/containers.rs• L134-162 docs/features.md• L203-209
Workload filtering
Filtering narrows resource views without changing the selected workload context. Plain input uses case-insensitive contiguous text matching, while ~ opts into fuzzy matching. Structured input also supports quoted text, regular expressions, inverse terms, alternatives, Boolean groups, label and field selectors, and typed comparisons for status, resources, restarts, and age. Kubernetes label and field selectors can limit the server-side result, while the remaining terms refine the displayed rows.
The filter reports malformed input instead of making the table appear empty. A resource query can also carry a resource kind, namespace, context, and filter as one validated scope, which supports repeatable movement from a broad cluster view to a workload-specific result.
References: src/filter.rs• L1-33 src/filter.rs• L262-317 src/filter.rs• L594-650
Usage trend views
Usage trends add short, session-local context to live CPU and memory values. A selected container shows a bounded recent sample history, while node rows show recent usage as relative levels against allocatable capacity. These views help distinguish a current spike from a stable pattern without claiming to provide long-term historical data.
The trend view keeps gaps visible when metrics are missing. It clears container history when the selected target, resource identity, or data generation changes, and it starts a new node history when a node is recreated under the same name. This prevents samples from one object or session state from being shown as evidence for another.
References: src/…/metrics_history.rs• L5-59 src/…/metrics_history.rs• L61-142 src/…/metrics_history.rs• L145-210
Log streams
The log view supports both live Kubernetes logs and historical provider logs. Kubernetes logs can cover a pod, selected containers, marked pods, or all pods matched by a workload or service selector. A VictoriaLogs view adds a lookback query and live tail for pods, containers, workloads, services, and namespaces, including logs for restarted or deleted pods.
The view keeps the streams readable while they change. It can sort timestamped lines, follow or pause output, filter by text or severity, show previous-container logs, and format JSON records. Provider access can be configured or discovered through the cluster API server, so missing history is reported as a provider problem rather than confused with an empty log stream.
References: src/…/logs.rs• L312-369 src/…/logs.rs• L372-426 src/…/logs.rs• L495-595 src/…/logs.rs• L862-1003 src/providers.rs• L1-19 src/providers.rs• L592-668
Resource documents and events
Single-resource views expose the object in the form needed for inspection. YAML shows the live object, describe presents an operational summary, and events provides a live stream scoped to the selected object's identity when possible. These views also support custom resources and retain enough context to return to the originating workload or analysis view.
Events are selected by object UID when available. If no UID exists, the view uses the object's name and namespace. This prevents old events for a deleted and recreated object from being presented as current evidence in the common case.
References: src/…/details.rs• L35-75 src/…/details.rs• L117-215 src/…/details.rs• L297-399 docs/features.md• L615-621
Workload health analysis
Health analysis combines live resource state with related pods and recent warning events. It is designed to answer why a workload is unhealthy instead of only showing that its status is bad.
Explanatory findings
The Explain view reads the selected object again, gathers its owned or selected pods, filters related events, and produces ranked findings. The analysis is deterministic and uses evidence such as replica counts, rollout conditions, scheduling failures, image-pull errors, crash loops, OOM kills, restart history, probe readiness, and recent warning events. Findings can lead directly to a blocking pod, its events, or its logs.
The view treats incomplete evidence as a warning. A failed pod or event list does not become an empty healthy result. A resource read or UID change also prevents findings from being built from an old object snapshot. Refresh can update the report while the underlying table continues to provide the navigation context.
References: src/…/explain.rs• L3-40 src/…/explain.rs• L53-105 src/…/explain.rs• L165-208 src/…/explain.rs• L212-320 src/explain.rs• L1-12 src/explain.rs• L87-99 src/explain.rs• L104-230 docs/features.md• L360-375
Session timelines
The timeline is a session-local history of state changes observed by the resource watch. It records meaningful changes such as workload generation changes, replica and readiness shifts, pod phases, restarts, waiting reasons, condition changes, creation, and deletion. It does not reconstruct history from before the session and does not write its entries to disk.
The timeline remains active while its view is open, so new watch observations can extend the selected object's history. Its bounded history keeps recent changes useful without turning a long-running session into an unbounded record.
References: src/timeline.rs• L1-12 src/timeline.rs• L20-27 src/timeline.rs• L70-129 src/timeline.rs• L199-318 src/…/timeline.rs• L3-29 docs/features.md• L376-379
Workload operations
Operational actions are exposed beside inspection views, but actions that can change cluster state use confirmation, read-only checks, and configured guardrails. The main workload-adjacent operations covered here are node draining and resource request review.
Node drain workflow
Node draining moves eligible pods away from one or more nodes after first making the nodes unschedulable. The operation checks whether pods have controllers, protects local emptyDir data by default, respects disruption protection through eviction, and reports completed, incomplete, unstarted, and still-cordoned nodes.
The form makes risky choices explicit. An engineer can permit unmanaged pods, delete emptyDir data, bypass eviction, set a grace period, or set a timeout. Canceling stops new requests and waiting, but it cannot undo a request already accepted by the API. A stopped operation can therefore leave a node cordoned and requires follow-up inspection.
References: src/…/drain.rs• L5-25 src/…/drain.rs• L129-165 src/…/drain.rs• L227-293 src/…/drain.rs• L327-366 src/…/drain.rs• L369-504 src/…/drain.rs• L507-604 docs/keys.md• L105-121 docs/features.md• L13-61
Resource right-sizing
Right-sizing compares current container requests with historical CPU and memory use from a Prometheus-compatible backend. It shows P50, P95, and P99 use, OOM and CPU-throttle evidence, and a suggested request based on P95 plus headroom. The result is an advisory report with a patch preview; it never changes the selected pod or workload.
The recommendation keeps missing data distinct from measured zero. A container with no usable history receives no recommendation, and only containers with a recommendation appear in the preview. Workload queries include current and past controller pod names that match the selected workload's naming pattern, while pod queries use the exact pod name.
References: src/…/rightsize.rs• L13-114 src/…/rightsize.rs• L118-195 src/…/rightsize.rs• L198-265 src/rightsize.rs• L1-9 src/rightsize.rs• L25-47 src/rightsize.rs• L62-80 src/rightsize.rs• L143-169 src/providers.rs• L1101-1141 src/providers.rs• L1217-1244 docs/providers.md• L6-31
Persistent-volume exploration
Persistent-volume exploration gives an engineer access to claim contents even though Kubernetes does not provide a file-list API for a PersistentVolumeClaim. The tool finds a running pod that already mounts the claim, then uses that pod as the access point for a bounded browser or shell.
Claim access and browsing
The PVC browser presents the local filesystem beside the remote volume. It supports directory navigation, bounded listings, symlink-aware entries, and a mount boundary that prevents navigation outside the claim. It rejects claims that are not bound and block-mode claims because neither provides a filesystem tree to browse.
When no running consumer can serve the claim, the tool can ask to create a short-lived helper pod. The helper path is a deliberate cluster write and is blocked by read-only mode and guardrails. It has an expiry, is removed when the browser closes when possible, and can be cleaned up after an interrupted session. Read-only mounts remain readable but do not accept uploads.
References: src/…/pvcexplore.rs• L39-90 src/…/pvcexplore.rs• L176-245 src/…/pvcexplore.rs• L247-373 src/…/pvcexplore.rs• L375-481 src/pvcexplore.rs• L1-9 src/pvcexplore.rs• L17-57 src/pvcexplore.rs• L169-255 src/pvcexplore.rs• L359-395 src/pvcexplore.rs• L622-663 docs/features.md• L666-697
Volume shell and transfer context
The same claim resolution can open a shell at the mounted path or support file transfer between the local filesystem and the volume. The access mode and mount selected for the claim control what the operation can safely do. The browser and shell keep helper-pod lifetime tied to the active operation so a temporary access pod is not removed before an interactive session starts.
References: src/…/pvcexplore.rs• L20-29 src/…/pvcexplore.rs• L184-190 src/…/pvcexplore.rs• L316-371 src/…/transfer.rs• L209-259 src/…/transfer.rs• L267-295 docs/features.md• L557-560
Change checklist
When these files or sections are changed, remember to consider these:
- Keep structured filter grammar aligned with the resource table's row values and server-side selector handling. A new comparison or marker can silently change which workloads reach every downstream view.
- Keep workload selector rules aligned across drill-down, aggregated logs, Explain evidence, and any diagnostic view. A selector change can silently change which pods support every downstream result.
- Keep container names and resource paths aligned between the container picker, right-sizing reports, and patch previews. A path mismatch can show valid data but produce a patch for the wrong target.
- Keep log-provider scope, field mapping, lookback, and stream-tail behavior aligned. History and live output must describe the same pod or workload scope.
- Keep drain options, confirmation levels, read-only checks, and final cordon reporting aligned. A change to cancellation or timeout behavior must preserve the fact that accepted eviction or delete requests cannot be reversed.
- Keep PVC helper identity, cleanup matching, mount-boundary checks, and access-mode rules aligned. A cleanup change must not delete another pod or allow a browser to leave the claim mount.
- Keep Explain evidence filtering and timeline transition rules tied to object identity and watch state. UID changes, relists, and missing permissions must not look like current health evidence or invented history.
- Keep trend sampling, resource identity, allocatable values, and missing-data display aligned. A history change must not carry CPU or memory samples from a replaced node or container into a new target.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A workload or service has no usable pod selector | Aggregated logs and workload pod evidence cannot be built | Show a warning instead of treating the workload as having no pods |
| A structured filter is malformed while it is being typed | The filter cannot describe the intended rows and may leave some terms unapplied | Report the parse error, keep the query open, and do not replace the table with a false empty result |
| The log provider cannot be discovered, queried, or tailed | Historical logs show an error or stop; kubelet logs remain a separate path | Keep provider failures in the log view and retain direct Kubernetes log support |
| Metrics are missing or a query fails | Right-sizing shows unknown values and no unsafe recommendation | Never turn a failed query into zero usage or a patch suggestion |
| A short trend history belongs to a replaced pod or node with the same name | The trend can suggest usage that belongs to a different resource | Match the resource identity and generation before rendering samples |
A drain is blocked by an unmanaged pod, emptyDir, disruption policy, API error, timeout, or cancellation | The operation stops with incomplete work and some nodes may remain cordoned | Validate before removal, report each node state, and require explicit risky options |
| A PVC is unbound, block-mode, has no running mount, or its helper cannot become ready | The volume cannot be browsed through an existing consumer or helper | Reject unsupported claims early and require a confirmed, guarded helper pod for recovery |
| A volume entry is unreadable, malformed, truncated, or points outside the mount | The browser could show false empty data or escape its requested scope | Bound listing size, distinguish unreadable from empty, and verify resolved paths inside the mount |
| Explain evidence is denied, stale, or belongs to a replaced UID | Findings can be incomplete or no longer describe the selected resource | Re-read the object, match events by UID when possible, and surface warnings for incomplete evidence |
Key files
| File | Why to read it |
|---|---|
| src/…/containers.rs | Defines the workload-to-container inspection context and the container state shown to the engineer. |
| src/filter.rs | Defines the workload table query language and the boundary between local row matching and server-side resource selection. |
| src/…/metrics_history.rs | Defines short-lived container and node usage trends and the identity rules that keep samples tied to the right resource. |
| src/…/logs.rs | Connects selected resources to direct, aggregated, previous, and provider-backed log views. |
| src/providers.rs | Describes the external log and metrics provider contracts used by history and right-sizing. |
| src/…/details.rs | Covers YAML, describe, live event views, and return context for transient inspection screens. |
| src/…/explain.rs | Shows how fresh workload evidence is gathered and connected to Explain navigation. |
| src/explain.rs | Defines the evidence-based health findings and the failure signals they interpret. |
| src/timeline.rs | Defines which watch changes become session-local timeline entries and how history stays bounded. |
| src/…/timeline.rs | Connects the selected resource to its live session timeline view. |
| src/…/drain.rs | Describes node drain options, safety checks, progress, cancellation, and final state reporting. |
| src/…/rightsize.rs and src/rightsize.rs | Explain the right-sizing report, missing-data rules, recommendation math, and patch preview. |
| src/…/pvcexplore.rs and src/pvcexplore.rs | Explain claim access, helper-pod recovery, bounded browsing, mount safety, and shell/transfer context. |
| docs/features.md | Gives the user-facing map of workload inspection, analysis, logs, right-sizing, PVC exploration, and document views. |