Using Azure IoT Operations (AIO) and found that issue of permissions denied and the cluster not running with the following messages? Here is how I fixed it…
When I connect to my clusters, my first action is to check if my pods or services are running with the following command, but recently I have at times been getting the subsequent output error:
WARN[0000] 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
The solution for me was to use this command.
If you encounter the following…
[sudo] password for danuw:
INFO[0000] Starting k3s v1.28.7+k3s1 (051b14b2)
INFO[0000] Configuring sqlite3 database connection pooling: maxIdleConns=2, maxOpenConns=0, connMaxLifetime=0s
INFO[0000] Configuring database table schema and indexes, this may take a moment…
INFO[0000] Database tables and indexes are up to date
INFO[0000] Kine available at unix://kine.sock
INFO[0000] Reconciling bootstrap data between datastore and disk
FATA[0000] starting kubernetes: preparing server: init cluster datastore and https: listen tcp :6443: bind: address already in use
…you can just stop the service with this command first:
Your k3s cluster should now start and you will be able to get the list of pods/services confirming everything is running as expected.
I have not yet been able to investigate if this is still happening on the latest versions of AIO, but please let me know in the comments if you have anymore info (including why this is even happening on some restarts and how to avoid it permanently).
I cannot remember where I found all this info through forum but publishing it so it is easy to access for me and others in the future. Hope that was useful…