<p>I started getting an error in my CI process <code>Please enter Username: error: EOF</code> when running <code>kubectl</code> commands. 
The kubectl version matches the cluster version, and I can run the same commands fine from my machine with the same configuration shown by <code>kubectl config view</code>.</p>

<p>Here are the logs:</p>

<pre><code>+ kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: REDACTED_FOR_QUESTION
  name: REDACTED_FOR_QUESTION
contexts:
- context:
    cluster: REDACTED_FOR_QUESTION
    user: REDACTED_FOR_QUESTION
  name: REDACTED_FOR_QUESTION
current-context: REDACTED_FOR_QUESTION
kind: Config
preferences: {}
users:
- name: REDACTED_FOR_QUESTION
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED
++ echo 'Starting Kube proxy - port is 8001'
++ set +e
++ echo 'using kubectl'
++ sleep 1
++ kubectl proxy --port=8001
error: EOF
++ cat backingfile
++ rm backingfile
++ set -e
+ echo Starting Kube proxy - port is 8001 using kubectl Please enter Username:
Starting Kube proxy - port is 8001 using kubectl Please enter Username:
+ kubectl version
Please enter Username: error: EOF
Exited with code 1
</code></pre>

<p>What I am doing in my script is the following:</p>

<pre><code>  echo "using kubectl"
  kubectl proxy --port=${KUBECTL_PROXY_PORT} &gt; backingfile &amp;
  sleep 1 &amp;&amp; cat backingfile &amp;&amp; rm backingfile
  set -e
</code></pre>

<p>As this allowed me to launch <code>kubectl</code> in the background but still get the logs of the command.</p>

<p>What is causing this error and how can I run the command successfully again? <code>Please enter Username: error: EOF</code></p>

nha
<p>It looks like you are pointing to the different <code>KUBECONFIG</code> files:</p>

<p><strong>1</strong>. You should verify your <code>KUBECONFIG</code> varaible,</p>

<p><strong>2</strong>. You can add in your script <code>--kubeconfig=absolute_path_to_the_KUBECONFIG_file</code> flag </p>

<p><strong>3</strong> You combine those above with <code>kubectl config --kubeconfig=XXXX use-context xxxx</code></p>

<p>Please follow <a href="https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/#define-clusters-users-and-contexts" rel="nofollow noreferrer">Define clusters, users, and contexts</a> </p>

<p>Hope this help.</p>
