1

Based on the KubeView README, I tried to run KubeView using the container provided here.

I run:

$ docker run --publish-all --name kubeview ghcr.io/benc-uk/kubeview:0.1.31

I get the following output:

2023/03/12 18:06:45 ### Kubeview v0.1.31 starting...
2023/03/12 18:06:45 ### Connecting to Kubernetes...
2023/03/12 18:06:45 ### Creating client with config file: /.kube/config
panic: stat /.kube/config: no such file or directory

goroutine 1 [running]:
main.main()
    /build/cmd/server/main.go:60 +0x6a5

I can see that the problem is that the tool is looking for the kubeconfig file in /.kube/config. It can't find it because mine is in my home directory, ~/.kube/config/

I tried to pass an environment variable like this:

$ docker run --publish-all --name kubeview -e KUBECONFIG=/Users/<MY_USERNAME>/.kube/config ghcr.io/benc-uk/kubeview:latest

It didn't work. Has anyone been able to run KubeView as a container? I'm on a Mac.

Shant Dashjian
  • 888
  • 11
  • 20

1 Answers1

1

You can mount your local kubeconfig file to the Docker image that you are trying, not sure if the way you follow Env variable option is suggested anywhere or not

Try something like :

docker run --publish-all --name kubeview -v ./config:/.kube/config ghcr.io/benc-uk/kubeview:0.1.31

./config - will the path of your ~/.kube/config/ local system

/.kube/config - path where your local file will get set in the container, so when container will run your local file will be available at that path

Tried with fake values, which not able to parse but it got the file

2023/03/12 19:28:04 ### Kubeview v0.0.0 starting...
2023/03/12 19:28:04 ### Connecting to Kubernetes...
2023/03/12 19:28:04 ### Creating client with config file: /.kube/config
panic: error loading config file "/.kube/config": couldn't get version/kind; json parse error: json: cannot unmarshal string into Go value of type struct { APIVersion string "json:\"apiVersion,omitempty\""; Kind string "json:\"kind,omitempty\"" }

goroutine 1 [running]:
main.main()
        /build/cmd/server/main.go:60 +0x6a5
Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
  • Now getting a new error: panic: invalid configuration: [unable to read client-cert /Users/<>/.minikube/profiles/minikube/client.crt for minikube due to open /Users/<>/.minikube/profiles/minikube/client.crt: no such file or directory, unable to read client-key /Users/<>/.minikube/profiles/minikube/client.key for minikube due to open /Users/<>/.minikube/profiles/minikube/client.key: no such file or directory, unable to read certificate-authority /Users/<>/.minikube/ca.crt for minikube due to open /Users/<>/.minikube/ca.crt:... – Shant Dashjian Mar 14 '23 at 00:28
  • 1
    looks like it's looking for other files, cert for auth, and not sure from where it;s taking minikube config – Harsh Manvar Mar 14 '23 at 06:45