Windows
Beginning with v1.5, Kubernetes started to introduce support for Windows nodes in its alpha version, upgrading this support to beta with the release of v1.9. Some of the key features for Windows containers are include:
Pod-level support for Windows containers (isolation=process)
Kernel load balancing based on Virtual Filtering Platform (VFP) Hyper-v Switch Extension
Windows container management via Container Runtime Interface (CRI)
Support for the use of the kubeadm command to add Windows nodes to an existing cluster
Recommended use of Windows Server Version 1803+ and Docker Version 17.06+
Note:
Control plane services still run on Linux servers, with only Kubelet, Kube-proxy, Docker, and network plugin services running on Windows nodes.
Windows Server 1803 is recommended since it fixes issues with Windows container symlinks, allowing ServiceAccount and ConfigMap to function normally.
Downloads
You can download the released binary files for Windows servers from https://github.com/kubernetes/kubernetes/releases. For instance,
Alternatively, you can compile from Kubernetes source code:
Network Plugins
The following network plugins are supported in Windows Server (note that the network plugin on Windows nodes must be the same as on Linux nodes):
L3 routing network plugins like wincni, where routing is configured in TOR switches, routers, or cloud services
Flannel v0.10.0+
Calico v3.0.1+
For more network topology modes, please refer to Windows container network drivers.
L3 Routing Topology
Example configuration for the wincni network plugin:
OVS Network Topology
Deployment
kubeadm
If the master node is deployed via kubeadm, Windows nodes can also be deployed through kubeadm:
Azure
On Azure, it is recommended to use acs-engine for automatic deployment of Master and Windows nodes.
First, create a Kubernetes cluster configuration file that includes Windows, named windows.json
You can then deploy using acs-engine:
Manual Deployment
(1) Install Docker on Windows Server by following these instructions: Install Docker
(2) Download kubelet.exe and kube-proxy.exe based on the earlier download section.
(3) Copy the Node spec file (kube config) from the Master node.
(4) Configure the CNI network plugin and base images.
(5) Use start-kubelet.ps1 to start kubelet.exe, and use start-kubeproxy.ps1 to start kube-proxy.exe
(6) If you are using the Host-Gateway network plugin, you will also need to use AddRoutes.ps1 to add static routes.
For a detailed step-by-step guide, you can refer to this.
Running Windows Containers
To schedule a container on a Windows node, use the NodeSelector beta.kubernetes.io/os: windows
, for example:
Running a DaemonSet:
Known Issues
Secrets and ConfigMaps can only be used as environmental variables
This is a known issue with versions 1709 and earlier and can be fixed by upgrading to version 1803.
Volume Support
Local, emptyDir, hostPath, AzureDisk, AzureFile, and flexvolume are currently the only types of volumes supported by Windows containers. It's important to note that the format for the Volume's path needs to be mountPath: "C:\\etc\\foo"
or mountPath: "C:/etc/foo"
.
Image Version Matching
In Windows Server version 1709
, you must use images with the 1709 tag, such as
microsoft/aspnet:4.7.1-windowsservercore-1709
microsoft/windowsservercore:1709
microsoft/iis:windowsservercore-1709
Likewise, for Windows Server version 1803
, you must use images with the 1803 tag. For Windows Server 2016
, you need to use images with the ltsc2016 tag, such as microsoft/windowsservercore:ltsc2016
.
Setting CPU and Memory
Starting from v1.10, Kubernetes supports setting CPU and memory for Windows containers:
Hyper-V Containers
Starting from v1.10, containers with Hyper-V isolation are supported (Alpha). Before use, the kubelet needs to be configured to enable the HyperVContainer
feature switch. Then you can specify a container for Hyper-V isolation using Annotation experimental.windows.kubernetes.io/isolation-type=hyperv
:
Other Known Issues
Only Windows Server 1709 or later versions support running multiple containers in a Pod (only Process isolation is supported)
StatefulSet is not currently supported
Automatic expansion of Windows Server Container Pods (Horizontal Pod Autoscaling) is not yet supported
The OS version of the Windows container needs to match the Host OS version; otherwise, the container will not be able to start
When using L3 or Host GW networks, you cannot access Kubernetes Services directly from the Windows Node (there is no such issue when using OVS/OVN)
On Window Server running on VMWare Fusion kubelet.exe may fail to start (this has been fixed in #57124)
The Weave network plugin is not currently supported
Calico network plugin only supports Policy-Only mode
For .NET containers that need to use
:
as an environment variable, you can replace:
in the environment variable with__
(see here for reference)
Appendix: Docker EE Installation Method
To install Docker EE stable version:
To install Docker EE preview version:
To upgrade Docker EE version:
Reference Documents
最后更新于