-
Notifications
You must be signed in to change notification settings - Fork 40.2k
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
Volumes are created in container with root ownership and strict permissions #2630
Comments
hostDir should get the same permissions as the existing host entry, though I am not sure we ensure a host direct exists before using hostDir Part of the problem here is that different containers can run as I filed moby/moby#9360 |
Would it be reasonable to add |
I don't think that we want that in the API long-term, so I'd rather apply a On Wed, Nov 26, 2014 at 9:07 AM, Carlos Sanchez notifications@github.com
|
That sounds good to me |
This is a good starter project |
Background When an external volume is mounted it’s permissions are set to ROOT (UID 0), therefore unless the process inside the container is launched as root, it won’t have permission to access the mounted directory. Proposed Workarounds on the Kuberentes side
Both approaches feel to me like they are breaking a layer of abstraction by having Kubernetes reach into the container to figure out what user the main process would start as, and doing something outside the container with that information. I feel like the right approach would be for the containers themselves to CHOWN any "mounted volumes" during setup (after creating and setting user). Thoughts? |
@thockin, after talking to some folks, I think @carlossg's approach of explicitly specifying the user in the API would be the cleanest work around. I don't thing we can apply "hidden heuristics" without doing icky violation of abstractions (like reaching in to a container to figure out what username to use and then mounting the container's Proposal to modify the API:
Thoughts? CC: @bgrant0607, @dchen1107, @lavalamp |
I think adding UID to volumes is a hack and redundant. I'd rather we do On Thu, Dec 18, 2014 at 3:13 PM, Saad Ali notifications@github.com wrote:
|
@saad-ali I think HostDir should not be left untouched. Let's consider this: Hadoop on restart, restores the blocks from the directory it stores data in. If we use emptyDir, the container which restarted will get another directory and the previous data will be lost. And Hadoop requires the permissions and ownership of directory to be set to the user starting Hadoop (hdfs). If HostDir is not allowed to change permissions as per user, then similar use cases to this cannot be achieved. Please, comment. |
Define restart? Do you mean the container crashed and came back, or do you On Mon, Jan 12, 2015 at 11:56 PM, Luqman notifications@github.com wrote:
|
@thockin Restart could be anything. It could be after pod failure or container failure. Or the container could be restarted, after changing some configurations (Hadoop needs to be restarted after changes in configs). Does that answer? |
This document mentions that when a pod is unbound, the emptyDir is deleted. In use case of Hadoop, the data might be essential and might be required when another pod of Hadoop comes back (or the container restarts). So, HostDir must be used to persist data even the pod is unbound. But Hadoop requires permissions to be set for the user for the data directory. Hope this explains. |
With docker-archive/libcontainer/pull/322, docker containers now allow specifying
|
There's an important distinction between a container restarting and a pod All of this is more complicated as soon as user namespaces land. On Wed, Jan 14, 2015 at 12:04 AM, Luqman notifications@github.com wrote:
|
/remove-lifecycle stale |
Bump. God I hate bots which come and hide information from developers. No, if it's not solved it's still an issue stale or not. |
Thanks, @mryellow for bringing it up. We will try to talk about this issue in storage meeting and see whether we can come up with some solution. Please share any details about the issue you encounter and any thoughts about how to solve it. Thanks! |
@jingxu97 Are the last 7.5 years of details shared not good enough? lol |
I think proper solution is to finish implementation of fsUser attribute similar to fsGroup. It seems to be partly implemented in kubelet (but not complete), also not in API at all (you cannot specify fsUser currently). |
Is the issue no longer an issue? |
I think it's becoming a must have feature when we use k8s. |
A broken use-case: "Using a volume to mount a git repository" Will give error:
|
will it be addressed anytime soon? |
any update please? |
will it be addressed anytime soon? |
It would be good to capture why an init container approach isn't good enough here. (I don't think it is, but we haven't yet captured why not - at least, not in enough detail). |
In case you are using restricted security polices, e.g., the ones that forbid runasroot, init container is nothing that can help here. |
/remove-area docker |
This is a VERY old issue which has largely been resolved. If I am understanding correctly, what the discussion has become is a request for a NEW feature - is that correct? Can we maybe open a new issue with details about that new feature and an appropriate title? |
@xhejtman perhaps you'd be willing to file that new issue? (anyone else is also welcome to) |
so actually to file a new issue about adding fsUser option to securityContext? |
Yes, and focus on the use-cases that drive the need and how it might be
implemented, especially in the face of a pod which has multiple containers
which might not all run as the same uid.
…On Thu, Dec 22, 2022, 4:41 AM xhejtman ***@***.***> wrote:
so actually to file a new issue about adding fsUser option to
securityContext?
—
Reply to this email directly, view it on GitHub
<#2630 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKWAVFMEMLAIEKE2IMNEF3WOREATANCNFSM4AYEGWWA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Awwww but it was JUST getting interesting!!! |
The emptyDir volumeMount is owned by root:root and permissions set to 750
hostDir is the same but with 755 permissions
Containers running with a non-root USER can't access the volumes
Related discussion at https://groups.google.com/forum/#!topic/google-containers/D5NdjKFs6Cc
and Docker issue moby/moby#9360
The text was updated successfully, but these errors were encountered: