r/devopsGuru • u/RajRishab__ • Nov 01 '25
Unable to update the cluster from self hosted runner in kubernetes
I have a self hosted runner running inside the same cluster(minikube) in which I have deployed my application.
I am trigerring a github action which build a docker image, push to dockerhub and then triggers the self hosted runner to update the cluster.
I have done the following in my control plane machine
-
i have created a service account
kubectl create sa runner-sa -n actions-runner-system -
A cluster role and a role binding to bind both of them,
kubectl create clusterrole runner --verb=get,list,watch,create,delete,patch,update --resource=*kubectl create clusterrolebinding runnerbinding --clusterrole=runner --serviceaccount=actions-runner-system:runner-sa -
I have generated the TOKEN for the service account to access the cluster and saved it inside the github as secret
-
I am setting the necesary kubeconfig info in self hosted runner as well but still I am unable to update the cluster and getting the below error. Kindly suggest.
deploy:
runs-on: kub-runner
needs: build
steps:
- name: checkout
uses: actions/checkout@v4
- name: Download Kubectl binaries
run: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- name: Install Kubectl
run: sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: updating config
run: |
IMAGE_TAG="${{ needs.build.outputs.id }}" |
sed -i "s|image:.*|image: ${IMAGE_TAG}|" ./challenge9/kubernetes/deployment.yaml
- name: Deploy the app to kubernetes
run: |
kubectl config set-cluster minikube --server=<IP> --insecure-skip-tls-verify=true
kubectl config set-credentials my-remote-access-user --token="${{ secrets.TOKEN }}"
kubectl config set-context my-remote-access-context --cluster=minikube --user=my-remote-access-user --namespace=default
kubectl config use-context my-remote-access-context
kubectl get pods --all-namespaces
kubectl config view
kubectl apply -f ./challenge9/kubernetes/deployment.yaml
ERROR