<p>I am trying to perform a simple operation of logging into my cluster to update image of a deployment. I am stuck at the first step. I get an error that connection to <code>localhost:8080</code> is refused. Please help. </p>

<pre><code>$ chmod u+x kubectl &amp;&amp; mv kubectl /bin/kubectl
$ $KUBE_CERT &gt; ca.crt
$ kubectl config set-cluster cfc --server=$KUBE_URL --certificate-authority=ca.crt
Cluster "cfc" set.
$ kubectl config set-context cfc --cluster=cfc
Context "cfc" created.
$ kubectl config set-credentials gitlab-admin --token=$KUBE_TOKEN
User "gitlab-admin" set.
$ kubectl config set-context cfc --user=gitlab-admin
Context "cfc" modified.
$ kubectl config use-context cfc
Switched to context "cfc".
$ echo "Deploying dashboard with version extracted from tag ${CI_COMMIT_TAG}"
Deploying dashboard with version extracted from tag dev-1.0.4-22
$ kubectl get pods
The connection to the server localhost:8080 was refused - did you specify the right host or port?
</code></pre>

<p>The reason why you have you connection refused is because your proxy is not started. Try executing code below so kubectl can access the cluster via proxy (localhost:8080).</p>

<pre><code>kubectl proxy --address 0.0.0.0 --accept-hosts '.*' &amp;
</code></pre>

<p>Another approach is to use <code>curl</code> and operate with your cluster just like in the following example:</p>

<pre><code>curl --cacert /path/to/cert -H "Bearer {your token}" "${KUBE_URL}/api"
</code></pre>
