Skip to content

Commit 0660f9a

Browse files
authored
Merge pull request #30436 from ravisantoshgudimetla/windows-pods
[docs][windows]: Pod OS field update
2 parents a8f9148 + 89e7446 commit 0660f9a

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

content/en/docs/reference/command-line-tools-reference/feature-gates.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ different Kubernetes components.
126126
| `GracefulNodeShutdown` | `true` | Beta | 1.21 | |
127127
| `HPAContainerMetrics` | `false` | Alpha | 1.20 | |
128128
| `HPAScaleToZero` | `false` | Alpha | 1.16 | |
129+
| `IdentifyPodOS` | `false` | Alpha | 1.23 | |
129130
| `IndexedJob` | `false` | Alpha | 1.21 | 1.21 |
130131
| `IndexedJob` | `true` | Beta | 1.22 | |
131132
| `InTreePluginAWSUnregister` | `false` | Alpha | 1.21 | |
@@ -801,6 +802,8 @@ Each feature gate is designed for enabling/disabling a specific feature:
801802
- `HyperVContainer`: Enable
802803
[Hyper-V isolation](https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/hyperv-container)
803804
for Windows containers.
805+
- `IdentifyPodOS`: Allows the Pod OS field to be specified. This helps in identifying the OS of the pod
806+
authoritatively during the API server admission time. In Kubernetes {{< skew currentVersion >}}, the allowed values for the `pod.spec.os.name` are `windows` and `linux`.
804807
- `ImmutableEphemeralVolumes`: Allows for marking individual Secrets and ConfigMaps as
805808
immutable for better safety and performance.
806809
- `InTreePluginAWSUnregister`: Stops registering the aws-ebs in-tree plugin in kubelet

content/en/docs/setup/production-environment/windows/intro-windows-in-kubernetes.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,37 @@ section refers to several key workload enablers and how they map to Windows.
153153
* `emptyDir` volumes
154154
* Named pipe host mounts
155155
* Resource limits
156+
* OS field:
157+
{{< feature-state for_k8s_version="v1.23" state="alpha" >}}
158+
`.spec.os.name` should be set to `windows` to indicate that the current Pod uses Windows containers.
159+
`IdentifyPodOS` feature gate needs to be enabled for this field to be recognized and used by control plane
160+
components and kubelet.
161+
{{< note >}}
162+
If the `IdentifyPodOS` feature gate is enabled and you set the `.spec.os.name` field to `windows`, you must not set the following fields in the `.spec` of that Pod:
163+
* `spec.hostPID`
164+
* `spec.hostIPC`
165+
* `spec.securityContext.seLinuxOptions`
166+
* `spec.securityContext.seccompProfile`
167+
* `spec.securityContext.fsGroup`
168+
* `spec.securityContext.fsGroupChangePolicy`
169+
* `spec.securityContext.sysctls`
170+
* `spec.shareProcessNamespace`
171+
* `spec.securityContext.runAsUser`
172+
* `spec.securityContext.runAsGroup`
173+
* `spec.securityContext.supplementalGroups`
174+
* `spec.containers[*].securityContext.seLinuxOptions`
175+
* `spec.containers[*].securityContext.seccompProfile`
176+
* `spec.containers[*].securityContext.capabilities`
177+
* `spec.containers[*].securityContext.readOnlyRootFilesystem`
178+
* `spec.containers[*].securityContext.privileged`
179+
* `spec.containers[*].securityContext.allowPrivilegeEscalation`
180+
* `spec.containers[*].securityContext.procMount`
181+
* `spec.containers[*].securityContext.runAsUser`
182+
* `spec.containers[*].securityContext.runAsGroup`
183+
184+
Note: In this table, wildcards (*) indicate all elements in a list. For example, spec.containers[*].securityContext refers to the Security Context object for all defined containers. If not, Pod API validation would fail causing admission failures.
185+
{{< /note >}}
186+
156187
* [Workload resources](/docs/concepts/workloads/controllers/) including:
157188
* ReplicaSet
158189
* Deployments

content/en/docs/setup/production-environment/windows/user-guide-windows-containers.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,21 @@ Users today need to use some combination of taints and node selectors in order t
160160
keep Linux and Windows workloads on their respective OS-specific nodes.
161161
This likely imposes a burden only on Windows users. The recommended approach is outlined below,
162162
with one of its main goals being that this approach should not break compatibility for existing Linux workloads.
163-
163+
{{< note >}}
164+
If the `IdentifyPodOS` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is
165+
enabled, you can (and should) set `.spec.os.name` for a Pod to indicate the operating system
166+
that the containers in that Pod are designed for. For Pods that run Linux containers, set
167+
`.spec.os.name` to `linux`. For Pods that run Windows containers, set `.spec.os.name`
168+
to Windows.
169+
170+
The scheduler does not use the value of `.spec.os.name` when assigning Pods to nodes. You should
171+
use normal Kubernetes mechanisms for
172+
[assigning pods to nodes](/docs/concepts/scheduling-eviction/assign-pod-node/)
173+
to ensure that the control plane for your cluster places pods onto nodes that are running the
174+
appropriate operating system.
175+
no effect on the scheduling of the Windows pods, so taints and tolerations and node selectors are still required
176+
to ensure that the Windows pods land onto appropriate Windows nodes.
177+
{{< /note >}}
164178
### Ensuring OS-specific workloads land on the appropriate container host
165179

166180
Users can ensure Windows containers can be scheduled on the appropriate host using Taints and Tolerations.

0 commit comments

Comments
 (0)