derailed / k9s

🐶 Kubernetes CLI To Manage Your Clusters In Style!
https://k9scli.io
Apache License 2.0
27.34k stars 1.71k forks source link

Ability to filter Completed pods #678

Open PeteE opened 4 years ago

PeteE commented 4 years ago




Is your feature request related to a problem? Please describe. Feature request. We run some cronjobs in our cluster which show up as Completed pods. These are usually just noise that clutter up the pod list.

For example, we might have a deployment/service namedmyapi and a cronjob like myapi-cron. When filtering on myapi I'd like to exclude the Completed pods.

Describe the solution you'd like I'd like a configuration setting that would filter out Completed pods from the pod listing.

Describe alternatives you've considered A better solution might be a generic filtering mechanism that can be specified in a config file.

Additional context I know this request is fairly vague so I will add some more details once I've given it more though.

derailed commented 4 years ago

@PeteE Thank you for this issue! In the mean time, if you don't want to see completed cronjobs you can set successfulJobsHistoryLimit=0 in your cronjob spec. Default is set to 3.

mgenereu commented 3 years ago

Would persisting filters and sorting into views be a nice generic solution for this? I type /Running and shift-c all the time.

sherifabdlnaby commented 2 years ago

I upvote this, setting successfulJobsHistoryLimit=0 is not a solution, I might still need the pods to still be in Kubernetes, I just need the ability from K9S to optional filter out the Completed pods when I am sure they're just noise.

sherifabdlnaby commented 2 years ago

What I do now is sort by state, and invert the sorting, which "works". But sometimes I want to sort by Age, and still hide Completed Pods.

mfn commented 2 years ago

I'm not yet one but having this as Alpha feature could persuade me to a license.

The 2 x shift-s workaround is indeed nice btw :) but when also interacting with regular pods (terminated, etc.) then they "jump" around (obviously).

I figure having them filtered out in the Pods view makes sense but still leave them accessible when going to CronJob -> selecting a job -> still seeing them in Jobs

nfoerster commented 1 year ago

I would also totally like this feature.

chrizel commented 1 month ago

A workaround I am using lately is by filtering out completed pods with the search query /!Completed. By using the k9s HotKeys feature we can put this into hotkeys.yaml:

hotKeys:
  shift-v:
    shortCut:    Shift-V
    description: Filter out completed pods
    command:     pods /!Completed
    keepHistory: true

Now, in the pods list, just press Shift-V and the completed pods are gone.