<p>When using the kubectl cli in a Windows DOS prompt, I get a prompt to enter a username, that works fine but when I press enter after entering a username the prompt for a password appears and then immediately acts like I hit the enter key, no chance to enter the password, looks like this, from the screen print you can see that I am using kubectl version 1.15.</p>

<p><a href="https://i.stack.imgur.com/9gZj8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9gZj8.png" alt="enter image description here"></a></p>

<p>If I try this using Git Bash, it behaves the same but responds with the error shown below</p>

<p><a href="https://i.stack.imgur.com/c83JD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c83JD.png" alt="enter image description here"></a></p>

<p>Same deal where the password prompt is not waiting for input. </p>

<p>Anyone ever seen this or have any thoughts on how I can provide a username and password to kubectl without storing it a plain test in the config file? </p>

<p>Also, I am using a corporate Kubernates cluster, so no options to move to a more current version or do anything else that would require admin access.</p>

<p>Posting this answer as community wiki with general guidelines for issues similar to this: </p>

<p><strong>TL;DR</strong></p>

<p><strong>The prompt for username and password is most probably caused by misconfigured <code>.kube/config</code>.</strong></p>

<p>As for: </p>

<blockquote>
  <p>Anyone ever seen this or have any thoughts on how I can provide a username and password to kubectl without storing it a plain test in the config file?</p>
</blockquote>

<p>There are a lot of possibilities for authentication in Kubernetes. All of them have some advantages and disadvantages. Please take a look on below links:</p>

<ul>
<li><a href="https://medium.com/@etienne_24233/comparing-kubernetes-authentication-methods-6f538d834ca7" rel="nofollow noreferrer">Medium.com: Comparing kubernetes authentication methods</a></li>
<li><a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/" rel="nofollow noreferrer">Kubernetes.io: Authentication</a></li>
</ul>

<hr>

<p>The prompt for username and password can appear when <code>.kube/config</code> file is misconfigured. I included one possible reason below: </p>

<p>Starting with correctly configured <code>.kube/config</code> for a <code>minikube</code> instance. </p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
clusters:
- cluster:
    certificate-authority: PATH_TO_SOMEWHERE/.minikube/ca.crt
    server: https://172.17.0.3:8443
  name: minikube
contexts:
- context:
    cluster: minikube
    user: minikube
  name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    client-certificate: PATH_TO_SOMEWHERE/client.crt
    client-key: PATH_TO_SOMEWHERE/client.key
</code></pre>

<p>Issuing commands with above <code>.kube/config</code> should not prompt for user and password as below: </p>

<pre class="lang-sh prettyprint-override"><code>$ kubectl get pods
No resources found in default namespace.
</code></pre>

<p>Editing <code>.kube/config</code> and changing: </p>

<pre class="lang-yaml prettyprint-override"><code>    user: minikube
</code></pre>

<p>to: </p>

<pre class="lang-yaml prettyprint-override"><code>    user: not-minikube
</code></pre>

<p>Will lead to: </p>

<pre class="lang-sh prettyprint-override"><code>$ kubectl  get pods
Please enter Username: minikube
Please enter Password: 
</code></pre>

<p>Correctly configuring <code>.kube/config</code> is heavily dependent on a solution used (like <code>minikube</code>, <code>kubeadm</code> provisioned cluster, and a managed cluster like <code>GKE</code>). Please refer to official documentation of solution used. </p>
