When deploying make deploy-all with KUBECONFIG=~/KUBECONFIG.yaml, I would see issues like this:
STDERR:
Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version": dial tcp 127.0.0.1:8080: connect: connection refused
COMBINED OUTPUT:
Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version": dial tcp 127.0.0.1:8080: connect: connection refused
Comparing release=cert-manager-operator, chart=., namespace=cert-manager-operator
in ./helmfile.yaml.gotmpl: in .helmfiles[0]: in charts/cert-manager-operator/helmfile.yaml.gotmpl: command "/opt/homebrew/bin/helm" exited with non-zero status:
Inside make, kubectl get-context would work properly, but helmfile seemed to have an issue with relative paths.
Setting an absolute path for my KUBECONFIG solved the problem.
We should document this and check for it in make check-kubeconfig
check-kubeconfig:
@kubectl cluster-info >/dev/null 2>&1 || (echo "ERROR: Cannot connect to cluster. Check KUBECONFIG." && exit 1)