Skip to content

kubectl get should have a way to filter for advanced pods status #49387

Open
@simonswine

Description

What happened:

I'd like to have a simple command to check for pods that are currently not ready

What you expected to happen:

I can see a couple of options:

  • There is some magic flag I am not aware of
  • Having a flag for kubectl get to filter the output using go/jsonpath
  • Distinguish between Pod Phase Running&Ready and Running
  • Flag to filter on ready status

How to get that currently:

kubectl get pods --all-namespaces -o json  | jq -r '.items[] | select(.status.phase != "Running" or ([ .status.conditions[] | select(.type == "Ready" and .state == false) ] | length ) == 1 ) | .metadata.namespace + "/" + .metadata.name'

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.sig/cliCategorizes an issue or PR as relevant to SIG CLI.

Type

No type

Projects

  • Status

    Needs Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions