rancher / rancher-cleanup

172 stars 43 forks source link

Getting 'kubectl get nodes' exited non-zero error #47

Closed adsz closed 1 year ago

adsz commented 1 year ago

I'm getting this error when I run the script:

Running cleanup.sh version unreleased
==================== WARNING ====================
THIS WILL DELETE ALL RESOURCES CREATED BY RANCHER
MAKE SURE YOU HAVE CREATED AND TESTED YOUR BACKUPS
THIS IS A NON REVERSIBLE ACTION
==================== WARNING ====================
'kubectl get nodes' exited non-zero, make sure environment variable KUBECONFIG is set to a working kubeconfig file

I've tried the below but still getting the same error:

export KUBECONFIG=/etc/rancher/k3s/k3s.yaml

echo $KUBECONFIG
/etc/rancher/k3s/k3s.yaml

kubectl create -f deploy/rancher-cleanup.yaml

Also tried

KUBECONFIG=~/.kube/config 
kubectl create -f deploy/rancher-cleanup.yaml

and kubectl --kubeconfig ~/.kube/config create -f deploy/rancher-cleanup.yaml

but still no luck.

superseb commented 1 year ago

If you manually run the script, please supply the output of kubectl get nodes as that is what is being checked before proceeding.

For running it with kubectl, it will deploy the Job and then it will run in a pod which should use the service account but I would like to see the logs from the pod to confirm.

Also please supply output of kubectl version.

github-actions[bot] commented 1 year ago

This repository uses an automated workflow to automatically label issues which have not had any activity (commit/comment/label) for 60 days. This helps us manage the community issues better. If the issue is still relevant, please add a comment to the issue so the workflow can remove the label and we know it is still valid. If it is no longer relevant (or possibly fixed in the latest release), the workflow will automatically close the issue in 14 days. Thank you for your contributions.

gcraenen commented 1 year ago

I have the same error