k3s permission denied when using kubectl

for your test labs

When you install k3s as described on k3s.io, you can run into the following error when you try a kubectl get po without sudo:

Unable to read /etc/rancher/k3s/k3s.yaml, please start server with -write-kubeconfig-mode to modify kube config permissions.
error: error loading config file “/etc/rancher/k3s/k3s.yaml”: open /etc/rancher/k3s/k3s.yaml: permission denied

There are a couple of solutions to run kubectl without sudo on k3s, without the need to reinstall k3s. I will list 2 of them

[Read More]