<p>I am trying to deploy my application into Rancher managed kubernetes cluster RKE. I have created pipeline in gitlab using auto devops. But when the helm chart is trying to deploy I get this error.
<em><strong>Error: Kubernetes cluster unreachable: Get &quot;http://localhost:8080/version?timeout=32s&quot;: dial tcp 127.0.0.1:8080: connect: connection refused</strong></em></p>
<p>Below is my deploy script:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>deploy:
  stage: deploy
  image: cdrx/rancher-gitlab-deploy
  only:
    - master
  script:
    - apk --no-cache add curl
    - curl -L https://get.helm.sh/helm-v3.3.0-rc.1-linux-amd64.tar.gz &gt; helm.tar.gz
    - tar -zxvf helm.tar.gz
    - mv linux-amd64/helm /usr/local/bin/helm
    - helm install mychart ./mychart</code></pre>
</div>
</div>
</p>
<p>Could someone help me in resolving this issue</p>

<p>I've bumped into the same issue when installing rancher on K3s, setting KUBECONFIG helped.</p>
<pre><code>export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
</code></pre>
