Skip to main content

K3s issue when trying to access cluster from another machine

problem:

kubectl get ns

E0108 21:42:56.860495  805013 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0108 21:42:56.862131  805013 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0108 21:42:56.863214  805013 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0108 21:42:56.864421  805013 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0108 21:42:56.865299  805013 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
error: You must be logged in to the server (the server has asked for the client to provide credentials)

or when you access to the api: 

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "Unauthorized",
  "reason": "Unauthorized",
  "code": 401
}

solution:

use the value config from the path into your ~/.kube/config

 

/etc/rancher/k3s/k3s.yaml