Longhorn v0.7.0 and above support k3s v0.10.0 and above only by default.
If you want to deploy these new Longhorn versions on versions before k3s v0.10.0, you need to set --kubelet-root-dir to <data-dir>/agent/kubelet for the Deployment longhorn-driver-deployer in longhorn/deploy/longhorn.yaml.
data-dir is a k3s arg and it can be set when you launch a k3s server. By default it is /var/lib/rancher/k3s.
2. For Longhorn before v0.7.0
Longhorn versions before v0.7.0 support k3s below v0.10.0 only by default.
If you want to deploy these older Longhorn versions on k3s v0.10.0 and above, you need to set --kubelet-root-dir to /var/lib/kubelet for the Deployment longhorn-driver-deployer in longhorn/deploy/longhorn.yaml
Failed to get arg root-dir: Cannot get kubelet root dir, no related proc for root-dir detection …
This error is due to Longhorn cannot detect where is the root dir setup for Kubelet, so the CSI plugin installation failed.
You will find data-dir in the cmdline of proc k3s. By default it is not set and /var/lib/rancher/k3s will be used. Then joining data-dir with /agent/kubelet you will get the root-dir. So the default root-dir for K3S is /var/lib/rancher/k3s/agent/kubelet.
If K3S is using a configuration file, you would need to check the configuration file to locate the data-dir parameter.
For K3S v0.10.0+
It is always /var/lib/kubelet
Longhorn versions before v0.7.0 don’t work on K3S v0.10.0 or above