Skip to content
Search Fedora

    Browse this documentation

    Installing k3s on Fedora: a single-node cluster with domestic mirrors

    Before installing Kubernetes on Fedora, know this: the repositories ship neither k3s nor kind.

    Terminal window
    dnf search --available kind k3s

    Nothing. So the upstream install script is the only route, which makes a domestic mirror essential.

    k3s from install to Ready, plus the kubeconfig 0600 permission problem

    Installing k3s through the domestic mirror

    Section titled “Installing k3s through the domestic mirror”

    k3s publishes a China mirror for both the script and the binaries:

    Terminal window
    curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh -o k3s-install.sh
    ls -l k3s-install.sh
    38251

    Run it with the mirror flag:

    Terminal window
    sudo INSTALL_K3S_MIRROR=cn sh k3s-install.sh

    The script reports each step:

    [INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
    [INFO] env: Creating environment file /etc/systemd/system/k3s.service.env
    [INFO] systemd: Creating service file /etc/systemd/system/k3s.service
    [INFO] systemd: Enabling k3s unit
    Created symlink '/etc/systemd/system/multi-user.target.wants/k3s.service' → '/etc/systemd/system/k3s.service'.
    [INFO] systemd: Starting k3s

    k3s brings its own systemd service, active immediately:

    Terminal window
    systemctl is-active k3s
    k3s --version
    active
    k3s version v1.36.5+k3s1 (3dd98cc5)

    The first kubectl call hits permission denied

    Section titled “The first kubectl call hits permission denied”
    error: error loading config file "/etc/rancher/k3s/k3s.yaml": open /etc/rancher/k3s/k3s.yaml: permission denied

    The kubeconfig is root-only:

    Terminal window
    ls -l /etc/rancher/k3s/k3s.yaml
    -rw-------. root root

    Two ways out.

    1. Use sudo (fastest)

    Terminal window
    sudo kubectl get nodes
    NAME STATUS ROLES AGE VERSION
    fd45-repo Ready control-plane 76s v1.36.5+k3s1

    2. Copy the kubeconfig into your home (for daily use)

    Terminal window
    mkdir -p ~/.kube
    sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
    sudo chown $USER ~/.kube/config
    kubectl get nodes
    Terminal window
    sudo kubectl get pods -A
    NAMESPACE NAME READY STATUS RESTARTS AGE
    kube-system coredns-7cfb7bc9c7-ckx4n 0/1 ContainerCreating 0 71s
    kube-system helm-install-traefik-crd-b8hss 0/1 ContainerCreating 0 71s
    kube-system helm-install-traefik-hwhd4 0/1 ContainerCreating 0 71s

    ContainerCreating right after install is normal — k3s is orchestrating itself, pulling the system components (CoreDNS, Traefik ingress) into containerd.

    A minute or two later they turn Running:

    Terminal window
    watch -n 5 sudo kubectl get pods -A
    ComponentRole
    corednsin-cluster DNS
    traefikdefault ingress controller
    local-path-provisionerdefault StorageClass
    metrics-serverbacks kubectl top

    k3s packs all of that into a single ~70 MB binary, which is why it fits a 4 GB single-node box while kubeadm does not.

    Terminal window
    sudo kubectl create deployment hello --image=nginx
    sudo kubectl expose deployment hello --port=80 --type=NodePort
    sudo kubectl get svc hello

    NodePort allocates a port in 30000–32767, reachable at the node IP plus that port.

    k3s drops an uninstaller:

    Terminal window
    sudo /usr/local/bin/k3s-uninstall.sh

    It stops the service, removes the unit, and clears /var/lib/rancher/k3s and the container data. Make sure no workload needs preserving first.

    kind needs Docker or Podman to host its “node containers”, which is one extra layer on Fedora. For single-node experiments k3s is simpler:

    OptionDependencyFits
    k3s (this page)none, ships containerdsingle-node labs, edge, light production
    kindDocker/PodmanCI clusters, multi-node topology tests
    minikubea driver (podman/docker/kvm)full Kubernetes feature validation
    SymptomCause
    kubectl cannot read the kubeconfigfile is 0600 root; use sudo or copy to ~/.kube/config
    pods stuck in ContainerCreatingstill pulling images; wait a minute or two
    image pulls slow or failingcontainerd has no registry mirror; see domestic mirrors
    memory pressure after installleave at least 2 GB free, 4 GB is comfortable
    k3s restart-loopsjournalctl -u k3s -n 50, usually port 6443 taken