Setup k3s on Ubuntu

Setup k3s on Ubuntu

  1. Install k3s as a service

    curl -sfL https://get.k3s.io | sh -
  2. Fix k3s permission denied issues

    mkdir ~/.kube 2> /dev/null
    export KUBECONFIG=~/.kube/config
    sudo k3s kubectl config view --raw > "$KUBECONFIG"
    chmod 600 "$KUBECONFIG"
  3. export KUBECONFIG=~/.kube/config to either ~/.profile or ~/.bashrc to make it persist on reboot(Optional).

    nano ~/.bashrc
    source ~/.bashrc

    Navigate to the last line

    ~/.bashrc
    # last line
    export KUBECONFIG=~/.kube/config
  4. Test connection

    kubectl get all