Most Kubernetes hardening advice assumes Linux nodes, so teams that add Windows worker nodes often carry over controls that silently do nothing on Windows and miss the ones that matter there. Seccomp, AppArmor, SELinux and Linux capabilities have no effect on Windows pods, Secrets land on the node disk in clear text, privileged access comes through HostProcess containers, and Active Directory identity arrives through group Managed Service Accounts (gMSA). This guide covers what changes on Windows nodes and how to secure each part: pod security, HostProcess admission, gMSA credential specs, node hardening and patching, and monitoring. It is for platform engineers and security teams running Windows workloads on Kubernetes. Feature states are as shown in the Kubernetes v1.37 documentation, checked in November 2026. For cluster-wide controls that apply to every node, see the Kubernetes Security Guide.
Key takeaways
- Many securityContext fields do nothing on Windows. Seccomp, AppArmor, SELinux, capabilities, readOnlyRootFilesystem and runAsGroup are not supported, so the Windows controls are runAsUserName, the default container user, admission policy and the node itself.
- HostProcess is the privileged container of Windows. Stable since v1.26, it runs as a host process with access to host network, storage and devices; Pod Security Standards Baseline and Restricted both disallow it, so allow it only in tightly controlled system namespaces.
- gMSA access is an authorisation decision. The credential spec holds no secrets, but the validating webhook and an RBAC "use" grant decide which service accounts can act as which Active Directory identity.
- Secrets on Windows nodes are written to disk. Kubernetes documents that Secret data is stored in clear text on local storage, and recommends file ACLs and BitLocker volume encryption.
- Patching is tied to image versions. The host OS version must match the container base image version, so node and image updates need planning together.
How Windows nodes differ
Kubernetes requires the control plane to run on Linux; only worker nodes can run Windows. Windows nodes must run Windows Server 2022 or Windows Server 2025 (Windows Server 2019 and later for the Mirantis Container Runtime), and Kubernetes supports only process isolation, not Hyper-V isolation. A pod cannot mix Windows and Linux containers.
| Control area | Linux nodes | Windows nodes | What to do on Windows |
|---|---|---|---|
| Privileged access to host | privileged: true, hostPID, hostIPC, hostNetwork | Privileged containers are not supported; HostProcess containers provide host access | Restrict windowsOptions.hostProcess through admission |
| Kernel attack surface filtering | Seccomp, AppArmor, SELinux | Not supported | Rely on process isolation, least-privilege user and node hardening |
| Capabilities | Drop ALL, add specific POSIX capabilities | Not supported | Run as ContainerUser where the image allows |
| Run as user | runAsUser, runAsGroup, runAsNonRoot | windowsOptions.runAsUserName; runAsGroup not supported | Set runAsUserName explicitly; know the base image default |
| Read-only root filesystem | Supported | Not supported | Use file ACLs in the image and immutable deployment |
| Secrets on the node | tmpfs (in memory) | Written to local storage in clear text | File ACLs on the Secret location, BitLocker volume encryption |
| Workload identity to Active Directory | Usually keytabs or external brokers | gMSA via credential spec | Webhooks plus RBAC "use" grants per credential spec |
| Isolation model | Namespaces and cgroups | Process isolation only | Treat node as the boundary; separate node pools by trust level |
| Image compatibility | Kernel generally backwards compatible | Host OS version must match the base image version | Pin images to node build; plan patches together |
The API server rejects pods that set certain Linux-only fields (for example spec.hostPID, seLinuxOptions or privileged) when spec.os.name is windows. That is useful: setting spec.os.name: windows on every Windows pod turns some silent no-ops into explicit errors.
Keep Windows and Linux workloads apart
The Kubernetes Windows user guide notes that spec.os.name does not affect scheduling. Use a nodeSelector on kubernetes.io/os: windows, which the guide calls the best practice, and optionally taint Windows nodes (for example registering the kubelet with os=windows:NoSchedule) so Linux pods without a selector cannot land there. The node.kubernetes.io/windows-build label (10.0.20348 for Windows Server 2022, 10.0.26100 for Windows Server 2025) pins pods to a matching OS build, and a RuntimeClass can bundle the selector and toleration for application teams.
HostProcess containers and their risk
HostProcess containers run as normal processes on the Windows host, with access to the host network namespace, storage and devices according to the user account they run as. Kubernetes lists their purpose as deploying network plugins, storage configuration, device plugins, kube-proxy and similar node components. There is no filesystem or Hyper-V isolation: they are constrained only by resource limits and the permissions of their user account. Treat any HostProcess pod as equivalent to administrator access on that node.
How HostProcess is configured
| Setting | Value required for HostProcess | Security note |
|---|---|---|
securityContext.windowsOptions.hostProcess | true | The field admission policy must control |
hostNetwork | true | Pod shares the node's network identity |
windowsOptions.runAsUserName | NT AUTHORITY\SYSTEM, NT AUTHORITY\Local service, NT AUTHORITY\NetworkService or a local usergroup name | Kubernetes advises LocalService (least privileged) where possible and LocalSystem only when absolutely necessary |
runAsNonRoot | Unset or false | Cannot be true, because HostProcess has privileged host access |
| Containers in the pod | All must be HostProcess | A pod cannot mix HostProcess and normal Windows containers |
| Runtime | containerd v1.6 or later (v1.7 recommended; v1.7 needed for local user accounts) | Check runtime version across all Windows node pools |
- Prefer local usergroups: with containerd v1.7 or later, setting
runAsUserNameto a local group creates an ephemeral local user in that group for each run, so no local passwords need managing. Grant the group only the node resources the component needs. - Restrict through admission: enforce Pod Security Standards Baseline or Restricted on every application namespace, which rejects
hostProcess: trueon the pod and on every container, init container and ephemeral container. Label only the specific system namespaces that host node agents as Privileged. - Add a precise policy: namespace-level Privileged is broad. Use a ValidatingAdmissionPolicy (stable since v1.30) or a policy engine to allow HostProcess only for named service accounts and approved image digests in those namespaces. See the Kubernetes Admission Control Guide.
- Lock down who can create pods there: RBAC rights to create pods, DaemonSets or ephemeral containers in a Privileged namespace are node administrator rights. Review them like domain admin rights. See the Kubernetes RBAC Guide.
- Protect service account tokens: HostProcess containers can read tokens through the mount paths Kubernetes documents (including
c:\var\run\secrets\kubernetes.io\serviceaccountwith containerd v1.7). Give node agents their own service accounts with minimal RBAC. See the Kubernetes Service Account Token Guide.
gMSA for Windows workloads
Windows containers cannot be domain joined, but applications inside them can use Active Directory authentication by running as a gMSA, a shared AD identity whose password is managed by the domain. Kubernetes support has been stable since v1.18. For gMSA fundamentals outside containers, see the Group Managed Service Accounts (gMSA) Guide.
How the pieces fit
- CRD: the
GMSACredentialSpeccustom resource (API groupwindows.k8s.io) stores each credential spec cluster-wide. - Mutating webhook: expands a gMSA reference by name in the pod spec into the full JSON credential spec.
- Validating webhook: checks that the pod's service account is authorised to use the referenced credential spec.
- RBAC: a ClusterRole grants the
useverb ongmsacredentialspecs, limited byresourceNamesto one spec, and a RoleBinding attaches it to a specific service account. - Pod reference:
securityContext.windowsOptions.gmsaCredentialSpecNameat pod or container level. - Node retrieval: on domain-joined nodes the node's computer account retrieves the gMSA password; on non-domain-joined nodes the ccg.exe plug-in uses a portable user identity from a secret store (supported from Windows Server 2019).
Handling credential specs securely
- The spec is not a secret, the grant is: the credential spec contains no password, but whoever can reference it gets that AD identity. Bind
useper spec and per service account, never with wildcards, and never to thedefaultservice account in production. - Keep the webhooks healthy: the validating webhook is the authorisation check. Monitor it, protect its namespace and TLS certificates, and test what happens to gMSA pods if it is unavailable.
- Scope password retrieval in AD: Microsoft recommends a dedicated security group per gMSA in
PrincipalsAllowedToRetrieveManagedPassword, containing only the hosts (or, for non-domain-joined setups, the portable user account) that need it. - Separate environments: Microsoft recommends separate gMSAs for development, test and production.
- Protect the portable identity: for non-domain-joined nodes, the portable account's credentials sit in the plug-in's secret store. Use a long, random, machine-generated password, restrict who can read that secret and rotate it. See the Kubernetes Secrets Security Guide.
- Register SPNs deliberately: containers do not register SPNs automatically; register the names clients actually use, such as the load balancer name.
Where identity fits
Windows nodes put three non-human identities side by side: Kubernetes service accounts, gMSAs and node computer or portable accounts. The risky chain is a service account that can reference a gMSA that has broad rights in AD. Inventory which service accounts can use which credential specs, what each gMSA can reach in the domain, and who can create pods with those service accounts. The Kubernetes NHI Security Guide covers the wider cluster identity model.
Pod security on Windows
Pod Security Admission works for Windows pods, with differences. Since v1.25 the Restricted profile reads spec.os.name: the Privilege Escalation, Seccomp and Linux Capabilities controls are only required when spec.os.name is not windows. Kubernetes notes that kubelets older than v1.24 do not enforce the pod OS field, so clusters with such nodes should pin Restricted to a version before v1.25. See the Kubernetes Pod Security Standards and Pod Security Admission Guide.
- Set
spec.os.name: windows: on every Windows pod template, so Restricted is evaluated correctly and Linux-only fields are rejected. - Know the default user: Windows containers have two default accounts. Nano Server images run as ContainerUser by default, Server Core images as ContainerAdministrator. Set
runAsUserName: ContainerUserwhere the application allows. - Enforce Baseline at minimum: on every Windows application namespace, with Restricted where workloads permit. Start in
warnandauditmode, then move toenforce. - Network policy: confirm your CNI enforces NetworkPolicy on Windows nodes before relying on it. See the Kubernetes Network Policy Guide.
Node hardening and patching
- Encrypt and restrict Secret storage: enable BitLocker on the volumes where the kubelet writes pod data and apply file ACLs to the Secret location, as the Kubernetes Windows security page recommends.
- Harden the OS baseline: apply a Windows Server baseline suited to container hosts, remove interactive logon for administrators except through break-glass, and manage the built-in local administrator with LAPS. See the Windows Endpoint Hardening Guide and the Local Administrator Password Solution (LAPS) Guide.
- Run containerd as a service account: Kubernetes documents that containerd must run as LocalSystem or LocalService for HostProcess logon tokens to work; do not work around errors by running it as an interactive user.
- Use signed pause images in production: the Windows documentation recommends
mcr.microsoft.com/oss/kubernetes/pause:3.6where signed binaries are required. - Patch by replacing nodes: because the host OS version must match the base image version, build new node images with monthly updates, rebuild application images on the matching base, then roll node pools. Treat in-place patching of long-lived nodes as the exception.
- Separate node pools by trust: process isolation means a container escape reaches the node. Keep internet-facing and sensitive workloads on separate pools.
Phased rollout
- Inventory: list Windows node pools, OS builds, containerd versions, HostProcess pods, credential specs and their RBAC bindings.
- Label and audit: apply Pod Security labels in
auditandwarnmode on Windows namespaces; setspec.os.nameon templates. - Contain HostProcess: move node agents into dedicated Privileged namespaces with an allow-list policy; enforce Baseline everywhere else.
- Tighten gMSA: replace broad
usegrants with per-spec, per-service-account bindings and dedicated AD retrieval groups. - Harden nodes: BitLocker, ACLs, baseline, LAPS, rebuilt images on a monthly cadence.
- Enforce and verify: switch to
enforceone namespace at a time. Roll back by removing the enforce label, which reverts to audit without redeploying workloads.
Monitoring and logging
| Signal | Source | Why it matters |
|---|---|---|
Pod create or update with hostProcess: true | Kubernetes audit log | New host-level access to a node; ATT&CK T1610 Deploy Container and T1611 Escape to Host |
Changes to gmsacredentialspecs and their RoleBindings | Kubernetes audit log | Someone granting a workload a new AD identity |
Pod Security audit and warn annotations | Kubernetes audit log and API responses | Workloads that would fail enforcement |
exec and ephemeral containers on Windows pods | Kubernetes audit log | Interactive access to workloads; ATT&CK T1609 Container Administration Command |
| gMSA logons from unexpected hosts | Domain controller security logs | Misuse of a gMSA identity; ATT&CK T1078.002 Domain Accounts |
| Kerberos ticket anomalies for gMSA accounts | Domain controller security logs | Possible ticket theft; ATT&CK T1558 Steal or Forge Kerberos Tickets |
| Process creation and service changes on nodes | Windows event logs and endpoint telemetry on the node | Activity from HostProcess containers appears as host processes |
See the Kubernetes Audit Log Detection Guide for audit policy and detection rules.
Metrics
- HostProcess footprint: number of HostProcess workloads, and percentage running in allow-listed namespaces with approved service accounts (target 100%).
- Pod Security coverage: percentage of Windows namespaces enforcing Baseline or Restricted.
- gMSA grant hygiene: number of credential specs with more than one bound service account, or bound to
default. - Node age: median age of Windows nodes since last image rebuild.
- Encryption coverage: percentage of Windows nodes with BitLocker enabled on pod data volumes.
Framework mapping
| Control on Windows nodes | NIST SP 800-53 Rev. 5 | NIST CSF 2.0 |
|---|---|---|
| HostProcess admission and least-privilege run-as accounts | AC-6 Least Privilege, CM-7 Least Functionality | PR.AA-05 |
| Pod Security labels, node baselines | CM-6 Configuration Settings | PR.PS-01 |
| Node image rebuild and patching | SI-2 Flaw Remediation | PR.PS-02 |
| gMSA and portable account credentials | IA-5 Authenticator Management | PR.AA-05 |
| Audit logging and node telemetry | AU-12 Audit Record Generation | DE.CM-09 |
Common failure patterns
- Copying Linux pod specs: seccomp profiles, dropped capabilities and read-only root filesystems that have no effect on Windows give a false sense of hardening.
- Privileged namespace sprawl: labelling a whole shared namespace Privileged to run one node agent, which lets any workload there request HostProcess.
- Running HostProcess as SYSTEM by habit: using LocalSystem when LocalService or a scoped local group would do.
- Wildcard gMSA grants: giving many service accounts
useon all credential specs, so any compromised workload can act as any AD identity. - Unencrypted Secret storage: forgetting that Secrets are written to the node disk and leaving volumes unencrypted.
- Stale nodes: long-lived Windows nodes left unpatched because image version matching makes updates awkward.
Practitioner checklist
- Set
spec.os.name: windows, akubernetes.io/osnodeSelector and a matching toleration on every Windows workload. - Enforce Pod Security Baseline or Restricted on all Windows application namespaces.
- Limit HostProcess to dedicated system namespaces, named service accounts and approved images, using an admission policy.
- Run HostProcess containers as LocalService or a scoped local usergroup unless SYSTEM is essential.
- Bind gMSA
useper credential spec and per service account; never todefault. - Use a dedicated AD group per gMSA for password retrieval and separate gMSAs per environment.
- Enable BitLocker and file ACLs for Secret storage on Windows nodes.
- Rebuild Windows node images and matching application images monthly and roll node pools.
- Alert on HostProcess pod creation and on changes to credential specs and their bindings.
Standards and references
- Kubernetes: Security for Windows Nodes
- Kubernetes: Create a Windows HostProcess Pod
- Kubernetes: Configure GMSA for Windows Pods and Containers
- Kubernetes: Pod Security Standards
- Kubernetes: Windows containers in Kubernetes
- Kubernetes: Guide for running Windows containers in Kubernetes
- Kubernetes: Validating Admission Policy
- Microsoft Learn: Create gMSAs for Windows containers
Related NHI Mgmt Group resources: Kubernetes Security Guide · Kubernetes Admission Control Guide · Group Managed Service Accounts (gMSA) Guide · Kubernetes Pod Security Standards and Pod Security Admission Guide