Skip to content

Fix kubectl_get returning wrong pod status (e.g. Running instead of CrashLoopBackOff)#275

Merged
Flux159 merged 1 commit intomainfrom
pr275
Feb 19, 2026
Merged

Fix kubectl_get returning wrong pod status (e.g. Running instead of CrashLoopBackOff)#275
Flux159 merged 1 commit intomainfrom
pr275

Conversation

@Flux159
Copy link
Owner

@Flux159 Flux159 commented Feb 12, 2026

Summary

  • Fix kubectl_get reporting incorrect pod status (e.g. "Running" instead of "CrashLoopBackOff")
  • Add getPodStatus() function that mirrors kubectl's own status computation logic from pkg/printers/internalversion/printers.go
  • Inspects container statuses (state.waiting.reason, state.terminated.reason), init container statuses, and pod deletion timestamps to derive the human-friendly status

Background

Previously, getResourceStatus() only returned pod.status.phase, which is the pod lifecycle phase (Running, Pending, Succeeded, Failed, Unknown). This doesn't reflect container-level statuses like CrashLoopBackOff, ImagePullBackOff, OOMKilled, Error, etc. A pod can have phase: Running while its container is in CrashLoopBackOff.

This was first identified in PR #130 which renamed status to phase to be more semantically accurate, but the underlying problem of not showing container-level statuses remained. Issue #273 reports the same problem in the current kubectl CLI-based implementation.

Test plan

  • Verify that pods in CrashLoopBackOff state show "CrashLoopBackOff" instead of "Running"
  • Verify that pods in ImagePullBackOff state show "ImagePullBackOff"
  • Verify that normally running pods still show "Running"
  • Verify that terminated pods show appropriate exit code/signal status
  • Verify that pods with failing init containers show "Init:" prefixed status
  • Verify that pods being deleted show "Terminating"
  • Run bun run build to confirm clean build

Fixes #273

🤖 Generated with Claude Code

…rashLoopBackOff)

The getResourceStatus function was only returning pod.status.phase which
doesn't reflect container-level statuses like CrashLoopBackOff,
ImagePullBackOff, OOMKilled, etc. This adds a getPodStatus function that
mirrors kubectl's own logic by inspecting container statuses, init
container statuses, and deletion timestamps.

Fixes #273

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Collaborator

@rr-paras-patel rr-paras-patel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Flux159 Flux159 merged commit f7cf181 into main Feb 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP server: kubectl_get_post doesn't show status crashloopbackoff for pod

2 participants