<p>I've enabled Kubernetes on Docker Desktop (on a Mac) - and when I run</p>
<pre><code>kubectl apply -f deployment.yml  
</code></pre>
<p>I get -</p>
<pre><code>&quot;error: You must be logged in to the server (Unauthorized)&quot;
</code></pre>
<p>Any help appreciated</p>

GmanG77
<p>In my case the problem was that somehow context was changed.
Checked it by</p>
<pre><code>kubectl config current-context
</code></pre>
<p>and then changed it back to the correct one by</p>
<pre><code>
kubectl config use-context docker-desktop
</code></pre>
