Welcome to the Linux Foundation Forum!

ERROR: Failed to connect to cluster


Lab 3.3 Installing Zarf on the Host Machine and the Air Gap VM

I am unable to get a package list with this command 'zarf package list' I get an
ERROR: Failed to connect to cluster.
I have ran the zarf init and deployed the k3s component with sudo
when I run the command 'sudo kubectl get node' i get:
fedora Ready control-plane,master 111m v1.24.1+k3s1
If I try to deploy the dos-game zarf package it tells me if cannot connect to the cluster and tells me to try setting the KUBERNETES_MASTER environment variable.
If I use echo $KUBERNETES_MASTER it prints nothing to the terminal.

I got the cluster URL by running this command:
kubectl cluster-info
I first tried using the control plane URL, but that didn't work. So I also tried CoreDNS and Metrics-server URLs. Same result.

After looking at the docs for zarf I found that the perroquets was to have docker installed. So I started over with docker installed and got the same error when running 'zarf package list'. ERROR: Failed to connect to cluster.

I am not sure what to try next. If someone has seen this or could give me a new trail to blaze down that would be great!


  • devinallen

    Okay, I was reading through the zarf docs and found this:
    (Linux only) Deploying the 'k3s' component will require root access (not just sudo), as it modifies your host machine to install the cluster and by default only provides access to the cluster to the root user.
    Running my terminal as root solved the problem. I didn't realize there was a difference between root and sudo. When i think I know linux...

    Although I still wonder if Docker is needed before running zarf. In the docs it says it is but I don't recall seeing any instructions in this course for installing docker.


Upcoming Training