<p>I have a cluster with RBAC in AKS, and it works just fine, but sometimes (it seems after my laptop goes to sleep) I just get this error and have to create context again:</p>
<p><code>kubectl error: You must be logged in to the server (Unauthorized)</code></p>
<p>It does not seem to happen all the time. Sometimes many sleep cycles (few days) passes, sometimes just few hours. It seem totally random.</p>
<p>Would appreciate any help on figuring out why this is happening.</p>
<p>My set up is like that (I don't know if it is important though):</p>
<p>I usually work on Windows Subsystem for Linux 2, but I have the same version of kubectl on windows itself and the config files are the same between the two (I linked kubectl config from linux).</p>
<p>I am pretty sure though I did not use windows kubectl last time it happened, only linux version</p>

Ilya Chernomordik
<p>I had the same issue with WSL2 and the reason is lack of time sync after laptop sleeping (see <a href="https://github.com/microsoft/WSL/issues/4245" rel="nofollow noreferrer">https://github.com/microsoft/WSL/issues/4245</a>)</p>
<p>After running <code>sudo hwclock -s</code> I have no more error message and can run kubectl comand.</p>
