k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Allow filtering for multiple namespaces at once

Open landorg opened this issue 2 years ago • 3 comments




Is your feature request related to a problem? Please describe. I'd like to be able to look at multiple namespaces at the same time

Describe the solution you'd like

  • :ns
  • select multiple ns with ctrl+<space>
  • <enter>
  • see resources from multiple namespaces

Describe alternatives you've considered

Alternative way along the lines of https://github.com/derailed/k9s/issues/1292 :ns ns1,ns2

Additional context This would make it easier to look at issues across multiple namespaces. Switching between them is currently a bit of a pain.

Thanks for the great tool :)

landorg avatar Jul 27 '22 08:07 landorg

Hello @landorg. Could you please show a couple of use cases here? Current k8s API doesn't support multiple ns, but we can simulate it making numerous requests.

Questions:

  1. What we should do if resources from 1 of 2 ns are not available to the current user?

Again: this is a huge enhancement and we should support this behavior for all resources but before I want to discuss all use cases and corner cases here :) Thanks!

slimus avatar Jul 27 '22 14:07 slimus

Hi and thanks for the quick reply. I'm used to that from the rancher ui. That's why I'm missing it here.

The main use-case for me is to just look at multiple namespaces at once. Eg. Doing an update of multiple apps in different namespaces I usually look at the pods view and filter for all of these namespaces to watch the update & debug in case something goes wrong.

Another one would be debugging an issue where multiple namespaces are involved. Eg. some service can't be reached => I'm filtering for the namespace with the load-balancer and the one with the service.

Currently to mitigate this issue I'm not filtering for a Namespace and using the search with /ns1|ns2 (similar to what is said in #1681 ). But this shows me multiple false-positives.

Thanks :v:

landorg avatar Aug 01 '22 13:08 landorg

This feature would be AMAZING! :)

I'm used to Lens, and just moving over to k9s. In Lens I quite often filter by multiple namespaces. Sometimes the work I'm doing revolves around a few different namespaces. I like to view all pods (or whatever object it is) across all those namespaces - without seeing all the system pods, or pods from namespaces I'm not interested in. This is one of the reasons at the moment, I quite often have to switch back to Lens for bits of work.

dracan avatar Sep 16 '22 16:09 dracan

That could be nice something along the way kubectl get po -A | grep -P '^(ns1|ns2)'

OriBenHur-akeyless avatar Dec 30 '22 12:12 OriBenHur-akeyless

+1 to this feature request

jotadrilo avatar Jan 26 '23 18:01 jotadrilo

+1 and current use case. Multiple namespaces to be managed by one team. looking for a Cronjob takes a few more clicks. would be nice to see them listed like ns:cronjob name maybe something like a local alias namespace that combines two into one.

kkoch-od avatar Jul 12 '23 16:07 kkoch-od

This idea came up today in a pairing session. I work on Consul and we deploy controllers and a management plane to the consul namespace, but we often deploy applications that are part of the mesh in the default or other namespaces. It would be wonderful to view the consul + default namespaces when debugging.

t-eckert avatar Nov 07 '23 15:11 t-eckert

There is somewhat of a workaround, but it definitely is a manual one. For the resource you want to look at, e.g. Pods, switch to "all" namespaces. Afterwards, start the search (hit /) and search for parts of all namespaces you're interested in, joined by |, e.g. default|kube-system. That said, I would very much prefer either a command line switch when calling k9s or an option when k9s is running.

Maddosaurus avatar Nov 07 '23 17:11 Maddosaurus