Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied on non-existing /etc/rancher/k3s/config.yaml after fresh install #7272

Closed
soupdiver opened this issue Apr 12, 2023 · 2 comments

Comments

@soupdiver
Copy link

Environmental Info:
K3s Version:
k3s version v1.26.3+k3s1 (01ea3ff)
go version go1.19.7

Node(s) CPU architecture, OS, and Version:
Linux ubuntu 5.15.0-69-generic #76-Ubuntu SMP Fri Mar 17 17:19:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Cluster Configuration:
1 server

Describe the bug:
After a fresh installation using the quick start guide I get the error FATA[0000] open /etc/rancher/k3s/config.yaml: permission denied for any kubectl or k3s kubectl command I run without sudo.
The thing is, that file doesnt even exist:

sudo ls -la /etc/rancher/k3s
total 12
drw-r--r-- 2 felix root 4096 Apr 11 23:50 .
drwxr-xr-x 4 root  root 4096 Apr 11 23:24 ..
-rw------- 1 felix root 2961 Apr 12 09:34 k3s.yaml

Steps To Reproduce:

  • Installed K3s:

Expected behavior:
I can run kubectl without sudo

Actual behavior:
I must use sudo for every kubectl command

Additional context / logs:

@osodracnai
Copy link
Contributor

please start the server with --write-kubeconfig-mode to modify kube config permissions, you can find more about it here

@brandond
Copy link
Contributor

The k3s command-line tools also need access to read the config file, or at least see if it exists. Your user doesn't have read access to the k3s directory, so it can't even see if it exists.

This is just basic Unix permissions stuff. You can continue to use sudo, or grant the owner and group search access to the directory: chmod ug+x /etc/rancher/k3s

@k3s-io k3s-io locked and limited conversation to collaborators Apr 12, 2023
@brandond brandond converted this issue into discussion #7278 Apr 12, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants