<p>Using minikube, when running the following command:</p>
<pre><code>kubectl -v=11 --kubeconfig /dev/null --insecure-skip-tls-verify -s http://localhost:8001 --token &quot;invalid&quot; -n namespace get pods
</code></pre>
<p>I have an answer when I don't want one. And I don't know how it was authorized. Moreover, if I use a valid token with specific rights, these are not used.</p>
<p><a href="https://stackoverflow.com/questions/60083889/kubectl-token-token-doesnt-run-with-the-permissions-of-the-token">kubectl --token=$TOKEN doesn&#39;t run with the permissions of the token</a> doesn't answer my question as I specified to used <strong>/dev/null</strong> as a config file.</p>
<p>Any idea ?</p>

Neok
<p>I will try to summarize the answer I provided in the comments.</p>
<p>The question was: <em>Why does running <code>kubectl -s http://localhost:8001 --kubeconfig /dev/null --token &lt;invalid_token&gt;</code> (where :8001 is a port opened by kubectl proxy) repoonds as if I was authorized, when it shouldn't beacause I set all possible authorization options to null or incorrect values?</em></p>
<p>The answer is that <code>kubectl proxy</code> opens a port and handles all authorization for you so you dont have to. Now to access REST api of kubernetes all you need to do is to use <code>curl localhost:8001/...</code>. No tokens and certificates.</p>
<p>Because you are already authorized with <code>kubectl proxy</code>, using kubectl and pointing it to localhost:8001 is causing that it won't need to authorize and you won't need any tokens to access k8s.</p>
<hr />
<p>As an alternative you can check what happens when you run the same but instead of connecting through <code>kubectl proxy</code> you use kubernetes port directly.</p>
<p>You mentioned that you are using minikube so by default that would be port 8443</p>
<pre><code>$ kubectl --kubeconfig /dev/null -s https://$(minikube ip):8443 --token &quot;invalid&quot; --insecure-skip-tls-verify get pods

error: You must be logged in to the server (Unauthorized)
</code></pre>
<p>As you see now it works as expected.</p>
