K9s: Change to "all" namespace not always working

Created on 4 Oct 2019  ·  6Comments  ·  Source: derailed/k9s






Describe the bug
K9s sometimes unable to find "all" namespace, when switching with the new syntax, e.g. po all.
Looks like every second time. :)
Btw, the previous namespaces menu missing from the header, so unable to switch namespaces with num keys, is this intentional?

To Reproduce
Steps to reproduce the behavior:

  1. Go to pod view
  2. Press :, type po all
  3. Error namespace not found

Expected behavior
Switching to all namespace

Log

8:48AM INF 🐶 K9s starting up...
8:48AM DBG Active Context `dlv-sbx-cluster-eks-51cea26`
8:48AM DBG Setting active ns "sbx"
8:48AM DBG Connecting to API Server https://*******.eks.amazonaws.com
8:48AM INF ✅ Kubernetes connectivity
8:48AM DBG [Config] Saving configuration...
8:48AM DBG Loading raw config from flags...
8:48AM INF No skin file found. Loading stock skins.
8:48AM INF No benchmark config file found, using defaults. error="open /home/ncsibra/.k9s/bench-dlv-sbx-cluster-eks-51cea26.yml: no such file or directory"
8:48AM DBG >>>>> Starting Informer in namespace "sbx"
8:48AM DBG GVR for pods.v1. -- schema.GroupVersionResource{Group:"", Version:"v1", Resource:"pods"}
8:48AM DBG Pod access granted!
8:48AM DBG GVR for nodes.v1. -- schema.GroupVersionResource{Group:"", Version:"v1", Resource:"nodes"}
8:48AM DBG CanI access nodes true -- <nil>
8:48AM DBG GVR for nodes.v1beta1.metrics.k8s.io -- schema.GroupVersionResource{Group:"metrics.k8s.io", Version:"v1beta1", Resource:"nodes"}
8:48AM DBG GVR for pods.v1beta1.metrics.k8s.io -- schema.GroupVersionResource{Group:"metrics.k8s.io", Version:"v1beta1", Resource:"pods"}
8:48AM DBG Running command pods
8:48AM ERR No custom aliases defined in config error="open /home/ncsibra/.k9s/alias.yml: no such file or directory"
8:48AM DBG Loading Views Elapsed 291.888389ms
8:48AM DBG Loading CRDS 44.408µs
8:48AM DBG Namespace did not change sbx
8:48AM DBG Running command v1/pods
8:48AM DBG [Config] Saving configuration...
8:48AM WRN No plugin configuration found
8:48AM DBG RUN CMD Elapsed 588.092861ms
8:48AM WRN No plugin configuration found
8:48AM WRN No plugin configuration found
8:48AM WRN No plugin configuration found
8:48AM WRN No plugin configuration found
8:48AM WRN No plugin configuration found
8:48AM WRN No plugin configuration found
8:48AM WRN No plugin configuration found
8:48AM WRN No plugin configuration found
8:48AM WRN No plugin configuration found
8:48AM WRN No plugin configuration found
8:48AM WRN No plugin configuration found
8:48AM DBG Running command po all
8:48AM DBG po updater canceled!
8:48AM ERR No custom aliases defined in config error="open /home/ncsibra/.k9s/alias.yml: no such file or directory"
8:48AM DBG Loading Views Elapsed 302.014185ms
8:48AM DBG Loading CRDS 26.709µs
8:48AM DBG Setting active ns "all"
8:48AM DBG Stopping NodeMetrix informer!
8:48AM DBG Stopping PodMetrix informer!!
8:48AM DBG NodeMetrics informer canceled!
8:48AM DBG PodMetrics informer stopped!
8:48AM ERR Checking NS Access error="namespaces \"all\" not found"
8:48AM ERR namespaces "all" not found error="namespaces \"all\" not found"
8:48AM ERR namespaces "all" not found error="namespaces \"all\" not found"
8:48AM DBG RUN CMD Elapsed 709.265004ms
8:48AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:48AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:48AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:48AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:48AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM DBG Running command po all
8:49AM ERR No custom aliases defined in config error="open /home/ncsibra/.k9s/alias.yml: no such file or directory"
8:49AM DBG Loading Views Elapsed 264.601945ms
8:49AM DBG Loading CRDS 13.366µs
8:49AM DBG Namespace did not change all
8:49AM DBG Running command v1/pods
8:49AM DBG [Config] Saving configuration...
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN No plugin configuration found
8:49AM DBG RUN CMD Elapsed 1.202809694s
8:49AM WRN No plugin configuration found
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN No plugin configuration found
8:49AM WRN No plugin configuration found
8:49AM WRN No plugin configuration found
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN No plugin configuration found
8:49AM WRN No plugin configuration found
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN No plugin configuration found
8:49AM DBG Running command po sbx
8:49AM ERR No custom aliases defined in config error="open /home/ncsibra/.k9s/alias.yml: no such file or directory"
8:49AM DBG po updater canceled!
8:49AM DBG Loading Views Elapsed 219.165249ms
8:49AM DBG Loading CRDS 26.807µs
8:49AM DBG Setting active ns "sbx"
8:49AM DBG >>>>> Starting Informer in namespace "sbx"
8:49AM DBG GVR for pods.v1. -- schema.GroupVersionResource{Group:"", Version:"v1", Resource:"pods"}
8:49AM DBG Pod access granted!
8:49AM DBG GVR for nodes.v1. -- schema.GroupVersionResource{Group:"", Version:"v1", Resource:"nodes"}
8:49AM DBG CanI access nodes true -- <nil>
8:49AM DBG GVR for nodes.v1beta1.metrics.k8s.io -- schema.GroupVersionResource{Group:"metrics.k8s.io", Version:"v1beta1", Resource:"nodes"}
8:49AM DBG GVR for pods.v1beta1.metrics.k8s.io -- schema.GroupVersionResource{Group:"metrics.k8s.io", Version:"v1beta1", Resource:"pods"}
8:49AM DBG Running command v1/pods
8:49AM DBG [Config] Saving configuration...
8:49AM WRN No plugin configuration found
8:49AM DBG RUN CMD Elapsed 1.317682641s
8:49AM WRN No plugin configuration found
8:49AM WRN No plugin configuration found
8:49AM DBG Running command po all
8:49AM DBG po updater canceled!
8:49AM ERR No custom aliases defined in config error="open /home/ncsibra/.k9s/alias.yml: no such file or directory"
8:49AM DBG Loading Views Elapsed 262.044058ms
8:49AM DBG Loading CRDS 30.274µs
8:49AM DBG Setting active ns "all"
8:49AM DBG Stopping PodMetrix informer!!
8:49AM DBG Stopping NodeMetrix informer!
8:49AM DBG PodMetrics informer stopped!
8:49AM DBG NodeMetrics informer canceled!
8:49AM ERR Checking NS Access error="namespaces \"all\" not found"
8:49AM ERR namespaces "all" not found error="namespaces \"all\" not found"
8:49AM ERR namespaces "all" not found error="namespaces \"all\" not found"
8:49AM DBG RUN CMD Elapsed 605.704012ms
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:49AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:50AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:50AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}
8:50AM WRN NodeMetrics &errors.errorString{s:"Invalid informer"}

Versions (please complete the following information):

  • OS: Manjaro Linux
  • K9s Rev: 0.9.0
  • K8s Rev: v1.14.6-eks-5047ed
bug

Most helpful comment

@ncsibra @paivagustavo Thank you both for reporting back!!

All 6 comments

I have hit the same problem. When it loads there is no metrics displayed.

Going in the code, this was probably a change on the Infomers, more specifically we are trying to check if a namespace named all exists because of this:

        // informer.go:70
    if err := client.CheckNSAccess(ns); err != nil {
        log.Error().Err(err).Msg("Checking NS Access")
        return nil, err
    }

I think I managed to fix this with #327, if possible checkout my code and test to confirm this?

@ncsibra @paivagustavo Thank you for this great report! I think the issue here is all is not being interpreted correctly. The other issue @ncsibra points out is my struggle with coming into K9s with a namespace. I think I've been a little too tight here ie seclude the user to that namespace only. I'll relax that rule and just let it fail if the user does not have access to other namespaces or listing namespaces for that matter. Either way great catch. Thank you Norbert!

@ncsibra @paivagustavo -- K let's see if 0.9.1 makes it all better

@derailed @paivagustavo It's fixed, thanks!

Yes, its working here as well :D

@ncsibra @paivagustavo Thank you both for reporting back!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrej-pavlov picture andrej-pavlov  ·  3Comments

ChrisCooney picture ChrisCooney  ·  3Comments

signaleleven picture signaleleven  ·  3Comments

cdunford picture cdunford  ·  3Comments

dalgibbard picture dalgibbard  ·  3Comments