-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Using "local-path" in persistent volume requires sudo to edit files on host node? #1823
Comments
When I use |
Depending on how the containers you're running are configured, your pods will likely either run as root, or a user with a different UID than your account. Any files created by other users would not be editable by your user without using sudo. |
@brandond That makes a log of sense. I did a I installed the Are there some ways to give my user write access to the persistent volume on the host without having to use
I haven't yet tried the above but any help would be greatly appreciated 🙏 |
The best answer is to exec into the pod to edit the files, but this is an anti-pattern as well. You don't normally manually edit files within pods or volumes, you uses some sort of automation to push changes out to your cluster. |
I encountered this as well on a clean install of CentOS8. I can work around by either elevating privileges manually in the busybox Reproducible by installing
|
Resolved with the following edits to /var/lib/rancher/k3s/server/manifests/local-storage.yaml Deployment - local-path-provisioner
ConfigMap - local-path-config
Apply
|
Hi @usrbinkat It was working for me two weeks ago on a Centos 7 and no longer works on a fresh install minimal centos 7. I got the same error as you. Unfortunately your workaround does not work for me. Also, I find it strange to redirect the K3s storage on /opt as it should really belong to /var. Any additional info you can provide on why you choose /opt here ? |
My resolution was disabling SELinux. I will get to the message related to the denial of creation of the PVC. |
@identitymonk It was a personally un-opinionated choice based on the official docs* yaml config map** diff'ed against the manifest built into k3s default local path provisioner deployment. I merely diffed the 2 sets of yaml & applied the differences I found. I could troubleshoot it further on my side with enough cycles to be sure. |
I also confirmed @identitymonk 's conclusion.
|
refer to #1821 |
Version:
k3s version v1.18.2+k3s1 (698e444)
K3s arguments:
Installed with
curl -sfL https://get.k3s.io | sh -
Describe the bug
When running a persistent volume with a persistent volume claim using local-path, the files on the host node are read only and require
sudo
to editTo Reproduce
Expected behavior
When I have files in the host node's
/configuration
directory without the deployment and persistent volumes running. I can edit the files fine withoutsudo
. I thought it would be more like sharing files involume
s in Docker where, when editing files on the host machine, no privileges are required.Actual behavior
Once I run the manifests and the
/configuration
directory is being shared as a persistent volume, when editing the files it states the files are read only and requiresudo
to write and save.Additional context / logs
Let me know if this is the actual expected behavior. I also tried to sanitize my manifests a little so if anything is confusing let me know
The text was updated successfully, but these errors were encountered: