<p>I've got a username and password, how do I authenticate kubectl with them?</p>

<p>Which command do I run?</p>

<p>I've read through: <a href="https://kubernetes.io/docs/reference/access-authn-authz/authorization/" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/access-authn-authz/authorization/</a> and <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/access-authn-authz/authentication/</a> though can not find any relevant information in there for this case.</p>

<hr>

<pre><code>kubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
</code></pre>

<p><a href="https://kubernetes-v1-4.github.io/docs/user-guide/kubectl/kubectl_config_set-credentials/" rel="nofollow noreferrer">https://kubernetes-v1-4.github.io/docs/user-guide/kubectl/kubectl_config_set-credentials/</a></p>

<hr>

<p>The above does not seem to work: 
<code>kubectl get pods<br>
Error from server (Forbidden): pods is forbidden: User "client" cannot list pods in the namespace "default": Unknown user "client"
</code></p>

<p>Kubernetes provides a number of different authentication mechanisms.  Providing a username and password directly to the cluster (as opposed to using an OIDC provider) would indicate that you're using Basic authentication, which hasn't been the default option for a number of releases.</p>

<p>The syntax you've listed appears right, assuming that the cluster supports basic authentication.</p>

<p>The error you're seeing is similar to the one <a href="https://stackoverflow.com/questions/49075723/what-does-unknown-user-client-mean">here</a> which may suggest that the cluster you're using doesn't currently support the authentication method you're using.</p>

<p>Additional information about what Kubernetes distribution and version you're using would make it easier to provide a better answer, as there is a lot of variety in how k8s handles authentication.</p>
