derailed / k9s

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

Invoking K9s ends in panic #2454

Closed hsingh131 closed 9 months ago

hsingh131 commented 9 months ago




Describe the bug The bug occurs when k9s is invoked in user shell

To Reproduce Steps to reproduce the behavior:

  1. Have M1 Macbook
  2. Run aws eks update-kubeconfig --name=clustername --region=us-east-1.aws --profile=your-profile
  3. Run k9s in shell returns
    
    k9s
    Error: the server has asked for the client to provide credentials
    Usage:
    k9s [flags]
    k9s [command]

Available Commands: completion Generate the autocompletion script for the specified shell help Help about any command info List K9s configurations info version Print version/build info

Flags: -A, --all-namespaces Launch K9s in all namespaces --as string Username to impersonate for the operation --as-group stringArray Group to impersonate for the operation --certificate-authority string Path to a cert file for the certificate authority --client-certificate string Path to a client certificate file for TLS --client-key string Path to a client key file for TLS --cluster string The name of the kubeconfig cluster to use -c, --command string Overrides the default resource to load when the application launches --context string The name of the kubeconfig context to use --crumbsless Turn K9s crumbs off --headless Turn K9s header off -h, --help help for k9s --insecure-skip-tls-verify If true, the server's caCertFile will not be checked for validity --kubeconfig string Path to the kubeconfig file to use for CLI requests --logFile string Specify the log file (default "/Users/Harshit.Singh/Library/Application Support/k9s/k9s.log") -l, --logLevel string Specify a log level (info, warn, debug, trace, error) (default "info") --logoless Turn K9s logo off -n, --namespace string If present, the namespace scope for this CLI request --readonly Sets readOnly mode by overriding readOnly configuration setting -r, --refresh int Specify the default refresh rate as an integer (sec) (default 2) --request-timeout string The length of time to wait before giving up on a single server request --screen-dump-dir string Sets a path to a dir for a screen dumps --token string Bearer token for authentication to the API server --user string The name of the kubeconfig user to use --write Sets write mode by overriding the readOnly configuration setting

Use "k9s [command] --help" for more information about a command.

panic: the server has asked for the client to provide credentials

goroutine 1 [running]: github.com/derailed/k9s/cmd.Execute(...) github.com/derailed/k9s/cmd/root.go:60 main.main() github.com/derailed/k9s/main.go:32 +0x4c



**Historical Documents**
When applicable please include any supporting artifacts: k9s debug logs, configurations, resource manifests, ...

**Expected behavior**
On running the k9s command a new shell with all cluster details should open up allowing user to switch between variety of k8s objects

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Versions (please complete the following information):**

- OS: v14.2.1
- K9s: v0.31.2]
- K8s: v.1.25

**Additional context**
Add any other context about the problem here.
derailed commented 9 months ago

@hsingh131 Looks like something is not quite right with your kubeconfig?? Does kubectl runs correctly on your eks cluster?

hsingh131 commented 9 months ago

It does, also k9s version 0.28.0 works fine

civilizeddev commented 9 months ago

I got this error (in macOS Sonoma)

panic: k9s config file "~/Library/Application Support/k9s/config.yaml" load failed:
Additional property fullScreenLogs is not allowed

goroutine 1 [running]:
github.com/derailed/k9s/cmd.Execute(...)
    github.com/derailed/k9s/cmd/root.go:60
main.main()
    github.com/derailed/k9s/main.go:32 +0x3c
derailed commented 9 months ago

@civilizeddev Please see v0.31.0 release notes section Breaking Bad! and/or the video (https://youtu.be/X3444KfjguE)

@hsingh131 which version of kubectl are you using?

root-io commented 9 months ago

@civilizeddev Moving ~/Library/Application Support/k9s to the trash fixed the issue for me.

muicoder commented 9 months ago
root@master1:~# k9s
Error: unable to activate context "": validation failed for "/root/.local/share/k9s/clusters/cluster.local/kubernetes-admin@cluster.local/config.yaml": yaml: line 14: could not find expected ':'
Usage:
  k9s [flags]
  k9s [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  info        List K9s configurations info
  version     Print version/build info

Flags:
  -A, --all-namespaces                 Launch K9s in all namespaces
      --as string                      Username to impersonate for the operation
      --as-group stringArray           Group to impersonate for the operation
      --certificate-authority string   Path to a cert file for the certificate authority
      --client-certificate string      Path to a client certificate file for TLS
      --client-key string              Path to a client key file for TLS
      --cluster string                 The name of the kubeconfig cluster to use
  -c, --command string                 Overrides the default resource to load when the application launches
      --context string                 The name of the kubeconfig context to use
      --crumbsless                     Turn K9s crumbs off
      --headless                       Turn K9s header off
  -h, --help                           help for k9s
      --insecure-skip-tls-verify       If true, the server's caCertFile will not be checked for validity
      --kubeconfig string              Path to the kubeconfig file to use for CLI requests
      --logFile string                 Specify the log file (default "/root/.local/state/k9s/k9s.log")
  -l, --logLevel string                Specify a log level (info, warn, debug, trace, error) (default "info")
      --logoless                       Turn K9s logo off
  -n, --namespace string               If present, the namespace scope for this CLI request
      --readonly                       Sets readOnly mode by overriding readOnly configuration setting
  -r, --refresh int                    Specify the default refresh rate as an integer (sec) (default 2)
      --request-timeout string         The length of time to wait before giving up on a single server request
      --screen-dump-dir string         Sets a path to a dir for a screen dumps
      --token string                   Bearer token for authentication to the API server
      --user string                    The name of the kubeconfig user to use
      --write                          Sets write mode by overriding the readOnly configuration setting

Use "k9s [command] --help" for more information about a command.

panic: unable to activate context "": validation failed for "/root/.local/share/k9s/clusters/cluster.local/kubernetes-admin@cluster.local/config.yaml": yaml: line 14: could not find expected ':'

goroutine 1 [running]:
github.com/derailed/k9s/cmd.Execute(...)
        github.com/derailed/k9s/cmd/root.go:60
main.main()
        github.com/derailed/k9s/main.go:32 +0x3c
root@master1:~# cat /root/.local/share/k9s/clusters/cluster.local/kubernetes-admin@cluster.local/config.yaml
k9s:
  cluster: cluster.local
  readOnly: false
  namespace:
    active: default
    lockFavorites: false
    favorites:
    - default
  view:
    active: po
  featureGates:
    nodeShell: false
  portForwardAddress: localhost
lhost
root@master1:~#
derailed commented 9 months ago

@muicoder Can you share your steps, k9s version and setup config/debug log? Also did you start k9s from a pristine env or had existing configs? Which OS are you running? Looking for solid repros since a few folks have been reporting this? Also if you fix the config by removing the trailing lhost. Does this happen again? Thank you for sharing the details!

hsingh131 commented 9 months ago

@civilizeddev Please see v0.31.0 release notes section Breaking Bad! and/or the video (https://youtu.be/X3444KfjguE)

@hsingh131 which version of kubectl are you using?

@derailed please find the requested details below

Client Version: v1.28.2 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3

schmidp commented 9 months ago

looks good v0.31.3 fixed the issue on my colleagues machine.

derailed commented 9 months ago

@schmidp Thanks for circling back Philip!