@@ -7,102 +7,84 @@ min-kubernetes-server-version: 1.22
7
7
8
8
<!-- overview -->
9
9
10
- {{< feature-state for_k8s_version="v1.22 " state="alpha " >}}
10
+ {{< feature-state for_k8s_version="v1.23 " state="beta " >}}
11
11
12
- Windows HostProcess containers enable you to run containerized
13
- workloads on a Windows host. These containers operate as
14
- normal processes but have access to the host network namespace,
15
- storage, and devices when given the appropriate user privileges.
12
+ Windows HostProcess containers enable you to run containerized
13
+ workloads on a Windows host. These containers operate as
14
+ normal processes but have access to the host network namespace,
15
+ storage, and devices when given the appropriate user privileges.
16
16
HostProcess containers can be used to deploy network plugins,
17
- storage configurations, device plugins, kube-proxy, and other
18
- components to Windows nodes without the need for dedicated proxies or
17
+ storage configurations, device plugins, kube-proxy, and other
18
+ components to Windows nodes without the need for dedicated proxies or
19
19
the direct installation of host services.
20
20
21
- Administrative tasks such as installation of security patches, event
22
- log collection, and more can be performed without requiring cluster operators to
23
- log onto each Window node. HostProcess containers can run as any user that is
24
- available on the host or is in the domain of the host machine, allowing administrators
25
- to restrict resource access through user permissions. While neither filesystem or process
26
- isolation are supported, a new volume is created on the host upon starting the container
27
- to give it a clean and consolidated workspace. HostProcess containers can also be built on
28
- top of existing Windows base images and do not inherit the same
29
- [ compatibility requirements] ( https://docs.microsoft.com/virtualization/windowscontainers/deploy-containers/version-compatibility )
30
- as Windows server containers, meaning that the version of the base images does not need
31
- to match that of the host. HostProcess containers also support
21
+ Administrative tasks such as installation of security patches, event
22
+ log collection, and more can be performed without requiring cluster operators to
23
+ log onto each Window node. HostProcess containers can run as any user that is
24
+ available on the host or is in the domain of the host machine, allowing administrators
25
+ to restrict resource access through user permissions. While neither filesystem or process
26
+ isolation are supported, a new volume is created on the host upon starting the container
27
+ to give it a clean and consolidated workspace. HostProcess containers can also be built on
28
+ top of existing Windows base images and do not inherit the same
29
+ [ compatibility requirements] ( https://docs.microsoft.com/virtualization/windowscontainers/deploy-containers/version-compatibility )
30
+ as Windows server containers, meaning that the version of the base images does not need
31
+ to match that of the host. It is, however, recommended that you use the same base image
32
+ version as your Windows Server container workloads to ensure you do not have any unused
33
+ images taking up space on the node. HostProcess containers also support
32
34
[ volume mounts] ( ./create-hostprocess-pod#volume-mounts ) within the container volume.
33
35
34
36
### When should I use a Windows HostProcess container?
35
37
36
- - When you need to perform tasks which require the networking namespace of the host.
38
+ - When you need to perform tasks which require the networking namespace of the host.
37
39
HostProcess containers have access to the host's network interfaces and IP addresses.
38
40
- You need access to resources on the host such as the filesystem, event logs, etc.
39
41
- Installation of specific device drivers or Windows services.
40
- - Consolidation of administrative tasks and security policies. This reduces the degree of
42
+ - Consolidation of administrative tasks and security policies. This reduces the degree of
41
43
privileges needed by Windows nodes.
42
44
43
45
44
- ## {{% heading "prerequisites" %}}
46
+ ## {{% heading "prerequisites" %}}% version-check %}}
45
47
46
- {{% version-check %}}
48
+ In 1.23 the HostProcess container feature is enabled by default. The kublet will
49
+ communicate with containerd directly by passing the hostprocess flag via CRI. You can use the
50
+ latest version of containerd (v1.6+) to run HostProcess containers.
51
+ [ How to install containerd.] ( /docs/setup/production-environment/container-runtimes/#containerd )
47
52
48
- To enable HostProcess containers while in Alpha you need to pass the following feature gate flag to
49
- ** kubelet** and ** kube-apiserver** .
50
- See [ Features Gates] ( /docs/reference/command-line-tools-reference/feature-gates/#overview )
51
- documentation for more details.
53
+ To * disable* HostProcess containers you need to pass the following feature gate flag to the
54
+ ** kubelet** and ** kube-apiserver** :
52
55
53
- ```
54
- --feature-gates=WindowsHostProcessContainers=true
56
+ ``` powershell
57
+ --feature-gates=WindowsHostProcessContainers=false
55
58
```
56
59
57
- You can use the latest version of Containerd (v1.5.4+) with the following settings using the containerd
58
- v2 configuration. Add these annotations to any runtime configurations were you wish to enable the
59
- HostProcess container feature.
60
-
60
+ See [ Features Gates] ( /docs/reference/command-line-tools-reference/feature-gates/#overview )
61
+ documentation for more details.
61
62
62
- ```
63
- [plugins]
64
- [plugins."io.containerd.grpc.v1.cri"]
65
- [plugins."io.containerd.grpc.v1.cri".containerd]
66
- [plugins."io.containerd.grpc.v1.cri".containerd.default_runtime]
67
- container_annotations = ["microsoft.com/hostprocess-container"]
68
- pod_annotations = ["microsoft.com/hostprocess-container"]
69
- [plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
70
- [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runhcs-wcow-process]
71
- container_annotations = ["microsoft.com/hostprocess-container"]
72
- pod_annotations = ["microsoft.com/hostprocess-container"]
73
- ```
74
63
75
- The current versions of containerd ship with a version of hcsshim that does not have support.
76
- You will need to build a version of hcsshim from the main branch following the
77
- [ instructions in hcsshim] ( https://github.com/Microsoft/hcsshim/#containerd-shim ) .
78
- Once the containerd shim is built you can replace the file in your contianerd installation.
79
- For example if you followed the instructions to
80
- [ install containerd] ( /docs/setup/production-environment/container-runtimes/#containerd )
81
- replace the ` containerd-shim-runhcs-v1.exe ` is installed at ` $Env:ProgramFiles\containerd ` with the newly built shim.
82
64
83
65
## Limitations
84
66
85
- - HostProcess containers require version 1.5.4 or higher of the containerd {{< glossary_tooltip text="container runtime" term_id="container-runtime" >}}.
86
- - As of v1.22 HostProcess pods can only contain HostProcess containers. This is a current limitation
67
+ - HostProcess containers require containerd 1.6 or higher
68
+ {{< glossary_tooltip text="container runtime" term_id="container-runtime" >}}.
69
+ - As of v1.23 HostProcess pods can only contain HostProcess containers. This is a current limitation
87
70
of the Windows OS; non-privileged Windows containers cannot share a vNIC with the host IP namespace.
88
- - HostProcess containers run as a process on the host and do not have any degree of
89
- isolation other than resource constraints imposed on the HostProcess user account. Neither
71
+ - HostProcess containers run as a process on the host and do not have any degree of
72
+ isolation other than resource constraints imposed on the HostProcess user account. Neither
90
73
filesystem or Hyper-V isolation are supported for HostProcess containers.
91
- - Volume mounts are supported and are mounted under the container volume.
92
- See [ Volume Mounts] ( #volume-mounts )
93
- - A limited set of host user accounts are available for HostProcess containers by default.
74
+ - Volume mounts are supported and are mounted under the container volume. See [ Volume Mounts] ( #volume-mounts )
75
+ - As of 1.23, a limited set of host user accounts are available for HostProcess containers by default.
94
76
See [ Choosing a User Account] ( #choosing-a-user-account ) .
95
- - Resource limits (disk, memory, cpu count) are supported in the same fashion as processes
77
+ - Resource limits (disk, memory, cpu count) are supported in the same fashion as processes
96
78
on the host.
97
- - Both Named pipe mounts and Unix domain sockets are ** not** currently supported and should instead
79
+ - Both Named pipe mounts and Unix domain sockets are ** not** currently supported and should instead
98
80
be accessed via their path on the host (e.g. \\\\ .\\ pipe\\\* )
99
81
100
82
## HostProcess Pod configuration requirements
101
83
102
- Enabling a Windows HostProcess pod requires setting the right configurations in the pod security
103
- configuration. Of the policies defined in the [ Pod Security Standards] ( /docs/concepts/security/pod-security-standards )
104
- HostProcess pods are disallowed by the baseline and restricted policies. It is therefore recommended
105
- that HostProcess pods run in alignment with the privileged profile.
84
+ Enabling a Windows HostProcess pod requires setting the right configurations in the pod security
85
+ configuration. Of the policies defined in the [ Pod Security Standards] ( /docs/concepts/security/pod-security-standards )
86
+ HostProcess pods are disallowed by the baseline and restricted policies. It is therefore recommended
87
+ that HostProcess pods run in alignment with the privileged profile.
106
88
107
89
When running under the privileged policy, here are
108
90
the configurations which need to be set to enable the creation of a HostProcess pod:
@@ -185,10 +167,10 @@ spec:
185
167
186
168
## Volume Mounts
187
169
188
- HostProcess containers support the ability to mount volumes within the container volume space.
189
- Applications running inside the container can access volume mounts directly via relative or
190
- absolute paths. An environment variable ` $CONTAINER_SANDBOX_MOUNT_POINT` is set upon container
191
- creation and provides the absolute host path to the container volume. Relative paths are based
170
+ HostProcess containers support the ability to mount volumes within the container volume space.
171
+ Applications running inside the container can access volume mounts directly via relative or
172
+ absolute paths. As of v1.23, an environment variable ` $CONTAINER_SANDBOX_MOUNT_POINT` is set upon container
173
+ creation and provides the absolute host path to the container volume. Relative paths are based
192
174
upon the `Pod.containers.volumeMounts.mountPath` configuration.
193
175
194
176
# ## Example {#volume-mount-example}
@@ -199,13 +181,22 @@ To access service account tokens the following path structures are supported wit
199
181
200
182
` $CONTAINER_SANDBOX_MOUNT_POINT\var\run\secrets\kubernetes.io\serviceaccount\`
201
183
184
+ # # Resource Limits
185
+
186
+ Resource limits (disk, memory, cpu count) are applied to the job and are job wide.
187
+ For example, with a limit of 10MB set, the memory allocated for any HostProcess job object
188
+ will be capped at 10MB. This is the same behavior as other Windows container types.
189
+ These limits would be specified the same way they are currently for whatever orchestrator
190
+ or runtime is being used. The only difference is in the disk resource usage calculation
191
+ used for resource tracking due to the difference in how HostProcess containers are bootstrapped.
192
+
202
193
# # Choosing a User Account
203
194
204
- HostProcess containers support the ability to run as one of three supported Windows service accounts :
195
+ As of 1.23, HostProcess containers support the ability to run as one of three supported Windows service accounts :
205
196
206
- - **[LocalSystem](https://docs.microsoft.com/en-us/ windows/win32/services/localsystem-account)**
207
- - **[LocalService](https://docs.microsoft.com/en-us/ windows/win32/services/localservice-account)**
208
- - **[NetworkService](https://docs.microsoft.com/en-us/ windows/win32/services/networkservice-account)**
197
+ - **[LocalSystem](https://docs.microsoft.com/windows/win32/services/localsystem-account)**
198
+ - **[LocalService](https://docs.microsoft.com/windows/win32/services/localservice-account)**
199
+ - **[NetworkService](https://docs.microsoft.com/windows/win32/services/networkservice-account)**
209
200
210
201
You should select an appropriate Windows service account for each HostProcess
211
202
container, aiming to limit the degree of privileges so as to avoid accidental (or even
0 commit comments