Skip to content

Commit 4c296c6

Browse files
committed
storage: document Windows projected volume limitations
xref: kubernetes/kubernetes#102849
1 parent c0dd24a commit 4c296c6

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

content/en/docs/concepts/storage/projected-volumes.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,56 @@ of the projected volume.
6868
A container using a projected volume source as a [`subPath`](/docs/concepts/storage/volumes/#using-subpath)
6969
volume mount will not receive updates for those volume sources.
7070
{{< /note >}}
71+
72+
## SecurityContext interactions
73+
74+
The [proposal for file permission handling in projected service account volume](https://github.com/kubernetes/enhancements/pull/1598)
75+
enhancement introduced the projected files having the the correct owner
76+
permissions set.
77+
78+
### Linux
79+
80+
In Linux pods that have a projected volume and `RunAsUser` set in the Pod
81+
[`SecurityContext`](/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context),
82+
the projected files have the correct ownership set including container user
83+
ownership.
84+
85+
### Windows
86+
87+
In Windows pods that have a projected volume and `RunAsUsername` set in the
88+
Pod `SecurityContext`, the ownership is not enforced due to the way user
89+
accounts are managed in Windows. Windows stores and manages local user and group
90+
accounts in a database file called Security Account Manager (SAM). Each
91+
container maintains its own instance of the SAM database, to which the host has
92+
no visibility into while the container is running. Windows containers are
93+
designed to run the user mode portion of the OS in isolation from the host,
94+
hence the maintenance of a virtual SAM database. As a result, the kubelet running
95+
on the host does not have the ability to dynamically configure host file
96+
ownership for virtualized container accounts. It is recommended that if files on
97+
the host machine are to be shared with the container then they should be placed
98+
into their own volume mount outside of `C:\`.
99+
100+
By default, the projected files will have the following ownership as shown for
101+
an example projected volume file:
102+
```powershell
103+
Path : Microsoft.PowerShell.Core\FileSystem::C:\var\run\secrets\kubernetes.io\serviceaccount\..2021_08_31_22_22_18.318230061\ca.crt
104+
Owner : BUILTIN\Administrators
105+
Group : NT AUTHORITY\SYSTEM
106+
Access : NT AUTHORITY\SYSTEM Allow FullControl
107+
BUILTIN\Administrators Allow FullControl
108+
BUILTIN\Users Allow ReadAndExecute, Synchronize
109+
Audit :
110+
Sddl : O:BAG:SYD:AI(A;ID;FA;;;SY)(A;ID;FA;;;BA)(A;ID;0x1200a9;;;BU)
111+
```
112+
This implies all administrator users like `ContainerAdministrator` will have
113+
read, write and execute access while, non-administrator users will have read and
114+
execute access.
115+
116+
{{< note >}}
117+
In general, granting the container access to the host is discouraged as it can
118+
open the door for potential security exploits.
119+
120+
Creating a Windows Pod with `RunAsUser` in it's `SecurityContext` will result in
121+
the Pod being stuck at `ContainerCreating` forever. So it is advised to not use
122+
the Linux only `RunAsUser` option with Windows Pods.
123+
{{< /note >}}

0 commit comments

Comments
 (0)