yashbhutwala / kubectl-df-pv

kubectl plugin - giving admins df (disk free) like utility for persistent volumes
Apache License 2.0
416 stars 32 forks source link

installation error #16

Open georgettica opened 3 years ago

georgettica commented 3 years ago

I installed from source and recieved the following output after running df-pv

I am using macos hence the cellar gopath

go version
go version go1.15.5 darwin/amd64

error output:

Error: error getting output slice: failed to list nodes: Get "http://localhost:8080/api/v1/nodes": dial tcp [::1]:8080: connect: connection refused
Usage:
  df-pv [flags]

Flags:
      --as string                      Username to impersonate for the operation
      --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --cache-dir string               Default cache directory (default "/Users/rong/.kube/cache")
      --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
      --context string                 The name of the kubeconfig context to use
  -d, --disable-color                  boolean flag for disabling colored output
  -h, --help                           help for df-pv
      --insecure-skip-tls-verify       If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --kubeconfig string              Path to the kubeconfig file to use for CLI requests.
  -n, --namespace string               If present, the namespace scope for this CLI request
      --request-timeout string         The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
  -s, --server string                  The address and port of the Kubernetes API server
      --tls-server-name string         Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
      --token string                   Bearer token for authentication to the API server
      --user string                    The name of the kubeconfig user to use
  -v, --verbosity string               log level; one of [info, debug, trace, warn, error, fatal, panic] (default "info")

FATA[2020-12-08T09:52:06+02:00] unable to run root command: Get "http://localhost:8080/api/v1/nodes": dial tcp [::1]:8080: connect: connection refused
failed to list nodes
github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.GetSliceOfOutputRowPVC
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv/root.go:349
github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.runRootCommand
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv/root.go:76
github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.setupRootCommand.func1
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv/root.go:56
github.com/spf13/cobra.(*Command).execute
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:842
github.com/spf13/cobra.(*Command).ExecuteC
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:950
github.com/spf13/cobra.(*Command).Execute
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:887
github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.InitAndExecute
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv/root.go:32
main.main
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/cmd/df-pv/main.go:10
runtime.main
    ${CELLAR_GOPATH}/src/runtime/proc.go:204
runtime.goexit
    ${CELLAR_GOPATH}/src/runtime/asm_amd64.s:1374
error getting output slice
github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.runRootCommand
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv/root.go:78
github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.setupRootCommand.func1
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv/root.go:56
github.com/spf13/cobra.(*Command).execute
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:842
github.com/spf13/cobra.(*Command).ExecuteC
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:950
github.com/spf13/cobra.(*Command).Execute
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/vendor/github.com/spf13/cobra/command.go:887
github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.InitAndExecute
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv/root.go:32
main.main
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/cmd/df-pv/main.go:10
runtime.main
    ${CELLAR_GOPATH}/src/runtime/proc.go:204
runtime.goexit
    ${CELLAR_GOPATH}/src/runtime/asm_amd64.s:1374
run df-pv root command
github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv.InitAndExecute
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/pkg/df-pv/root.go:32
main.main
    ${BASE_GOPATH}/src/github.com/yashbhutwala/kubectl-df-pv/cmd/df-pv/main.go:10
runtime.main
    ${CELLAR_GOPATH}/src/runtime/proc.go:204
runtime.goexit
    ${CELLAR_GOPATH}/src/runtime/asm_amd64.s:1374
yashbhutwala commented 3 years ago

Hi @georgettica this seems like a connection issue to the apiserver... are you sure you are able to connect to the apiserver while running this plugin? i.e.: just basic things like kubectl get po, and specifically able to reach api/v1/nodes (https://github.com/yashbhutwala/kubectl-df-pv#requirements)

georgettica commented 3 years ago

But shouldn't the apiserver not be at localhost? Are you using kubectl proxy? I would rather communicated using a KUBECONFIG / get a better error message to direct me.

I will also when I am near a ⌨️ I will test it

georgettica commented 3 years ago

Seems like I wasn't here on this, hopefully soon I will take a look (doing some spring cleaning)