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. Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
Below is my deploy script:
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 > helm.tar.gz
- tar -zxvf helm.tar.gz
- mv linux-amd64/helm /usr/local/bin/helm
- helm install mychart ./mychart
Could someone help me in resolving this issue
I had a similar error. A bit of background context: I was working with multiple cluster and by mistake, I edited the
.kube/config
manually. This resulted in an invalid configuration with thecontext.cluster
,context.user
parameters missing. I filled in those values manually and it worked again.Before fixing, the
config
file had a portion like this:I updated it as
To update the values, I used values from
kubectl config get-contexts
(I had the output of above command in terminal history which helped in updating).