When I add this command:
sudo kubectl get node --kubeconfig /etc/kubernetes/admin.conf
I got
NAME STATUS ROLES AGE VERSION
master NotReady control-plane 42m v1.26.1
but when I send:
sudo kubectl get node
I got
E0126 08:58:10.293496 32223 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0126 08:58:10.294046 32223 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0126 08:58:10.295501 32223 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0126 08:58:10.297011 32223 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0126 08:58:10.298647 32223 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
The connection to the server localhost:8080 was refused - did you specify the right host or port?
However, I exported the KUBECONFIG and sending
kubectl config view
will not return empty.
Shouldn't both work the same?