I have a Rancher k3s cluster running for 2 years already. I am regularly updating by kubectl command line.
Today I get the error E0321:
err="couldn't get current server API group list: the server has asked for the client to provide credentials"
Here is the fragment of the log when I run the command with verbose output (-v=10)
...
I0321 19:35:14.075828 10800 round_trippers.go:510] HTTP Trace: Dial to tcp:192.168.1.120:6443 succeed
I0321 19:35:14.081180 10800 round_trippers.go:553] GET https://192.168.1.120:6443/api?timeout=32s 401 Unauthorized in 6 milliseconds
I0321 19:35:14.081193 10800 round_trippers.go:570] HTTP Statistics: DNSLookup 0 ms Dial 1 ms TLSHandshake 3 ms ServerProcessing 2 ms Duration 6 ms
I0321 19:35:14.081199 10800 round_trippers.go:577] Response Headers:
I0321 19:35:14.081205 10800 round_trippers.go:580] Content-Type: application/json
I0321 19:35:14.081210 10800 round_trippers.go:580] Content-Length: 129
I0321 19:35:14.081215 10800 round_trippers.go:580] Date: Fri, 21 Mar 2025 12:35:14 GMT
I0321 19:35:14.081220 10800 round_trippers.go:580] Audit-Id: a90fb40d-8bcc-43db-86a0-057475044132
I0321 19:35:14.081223 10800 round_trippers.go:580] Cache-Control: no-cache, private
I0321 19:35:14.081302 10800 request.go:1351] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unauthorized","reason":"Unauthorized","code":401}
E0321 19:35:14.081397 10800 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: the server has asked for the client to provide credentials"
I0321 19:35:14.082508 10800 cached_discovery.go:120] skipped caching discovery info due to the server has asked for the client to provide credentials
...
This is happening from my laptop.
Now if I SSH to the master node, I can run kubectl commands. I copied the .kube/config from the master node to my laptop. I still get the error.
Both cluster and my laptop use the same version of kubectl:
On server:
$ kubectl version --client
Client Version: v1.31.2-rc2+k3s1
Kustomize Version: v5.4.2
On my laptop:
$ kubectl version --client
Client Version: v1.31.2
Kustomize Version: v5.4.2
Is there anything else I can do to check?