<p>My last deployment pipeline stage on gitlab suddently started asking for username when running &quot;kubectl apply&quot; command to deploy my application in my cluster in GKE (version 1.18.12-gke.1201 and also tested in 1.17). I'm using the imge dtzar/helm-kubectl to run kubectl commands in the pipeline (also tested older versions of this image). This is the log generated when running the stage:</p>
<pre><code>$ kubectl config set-cluster $ITINI_STAG_KUBE_CLUSTER --server=&quot;$ITINI_STAG_KUBE_URL&quot; --insecure-skip-tls-verify=true
Cluster &quot;itini-int-cluster&quot; set.
$ kubectl config set-credentials gitlab --token=&quot;$ITINI_STAG_KUBE_TOKEN&quot;
User &quot;gitlab&quot; set.
$ kubectl config set-context default --cluster=$ITINI_STAG_KUBE_CLUSTER --user=gitlab
Context &quot;default&quot; created.
$ kubectl config use-context default
Switched to context &quot;default&quot;.
$ kubectl apply -f deployment.yml
Please enter Username: error: EOF
</code></pre>
<p>I reproduced the same commands locally, and it's working fine.</p>
<p>When running &quot;kubectl version&quot; in the pipeline, this is the output:</p>
<pre><code>Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;19&quot;, GitVersion:&quot;v1.19.4&quot;, GitCommit:&quot;d360454c9bcd1634cf4cc52d1867af5491dc9c5f&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2020-11-11T13:17:17Z&quot;, GoVersion:&quot;go1.15.2&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
</code></pre>
<p>When running it locally (with exact same environment variables and tokens configured in the pipeline), this is the output:</p>
<pre><code>Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;20&quot;, GitVersion:&quot;v1.20.0&quot;, GitCommit:&quot;af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2020-12-08T17:59:43Z&quot;, GoVersion:&quot;go1.15.5&quot;, Compiler:&quot;gc&quot;, Platform:&quot;windows/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;18+&quot;, GitVersion:&quot;v1.18.12-gke.1201&quot;, GitCommit:&quot;160736941f00e54acb1c0a4647166b6f6eb211d9&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2020-12-08T19:38:26Z&quot;, GoVersion:&quot;go1.13.15b4&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
</code></pre>
<p>What could be causing this problem?</p>

Hugo Sartori
<p>The problem was actually in gitlab. My token variable was marked as &quot;protected&quot; in the gitlab settings, and it was being replaced by an empty string when running the config command. So, the problem was solved by unmarking it as protected.</p>
