Skip to content

Commit 4050406

Browse files
committed
Windows proposal
1 parent 51b6068 commit 4050406

File tree

1 file changed

+286
-0
lines changed

1 file changed

+286
-0
lines changed
Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
---
2+
title: Windows kubeadm-based worker nodes support
3+
authors:
4+
- "@jsturtevant"
5+
- "@ksubrmnn"
6+
reviewers:
7+
- "@CecileRobertMichon"
8+
- "@ncdc"
9+
- "@randomvariable"
10+
creation-date: 2020-08-25
11+
last-updated: 2020-09-09
12+
status: implementable
13+
see-also:
14+
---
15+
16+
# Windows kubeadm-based worker nodes support
17+
18+
## Table of Contents
19+
20+
- [Windows kubeadm-based worker nodes support](#windows-kubeadm-based-worker-nodes-support)
21+
- [Table of Contents](#table-of-contents)
22+
- [Glossary](#glossary)
23+
- [Summary](#summary)
24+
- [Motivation](#motivation)
25+
- [Goals](#goals)
26+
- [Non-Goals/Future Work](#non-goalsfuture-work)
27+
- [Proposal](#proposal)
28+
- [Cluster API Bootstrap Provider Kubeadm](#cluster-api-bootstrap-provider-kubeadm)
29+
- [cloud-init and cloudbase-init](#cloud-init-and-cloudbase-init)
30+
- [Image Creation](#image-creation)
31+
- [Kubelet and other component configuration](#kubelet-and-other-component-configuration)
32+
- [netbios names](#netbios-names)
33+
- [Infrastructure provider implementation](#infrastructure-provider-implementation)
34+
- [User Stories](#user-stories)
35+
- [As an operator, I would like to create Windows OS worker nodes with the CAPI API.](#as-an-operator-i-would-like-to-create-windows-os-worker-nodes-with-the-capi-api)
36+
- [As an operator, I would like to manage Windows OS worker nodes with the CAPI API.](#as-an-operator-i-would-like-to-manage-windows-os-worker-nodes-with-the-capi-api)
37+
- [Implementation Details/Notes/Constraints](#implementation-detailsnotesconstraints)
38+
- [Signing of the components.](#signing-of-the-components)
39+
- [Known prototypes and prior work:](#known-prototypes-and-prior-work)
40+
- [Security Model](#security-model)
41+
- [Risks and Mitigations](#risks-and-mitigations)
42+
- [Alternatives](#alternatives)
43+
- [Upgrade Strategy](#upgrade-strategy)
44+
- [Additional Details](#additional-details)
45+
- [Test Plan [optional]](#test-plan-optional)
46+
- [Graduation Criteria [optional]](#graduation-criteria-optional)
47+
- [Alpha](#alpha)
48+
- [Beta](#beta)
49+
- [Stable](#stable)
50+
- [Version Skew Strategy](#version-skew-strategy)
51+
- [Implementation History](#implementation-history)
52+
53+
## Glossary
54+
55+
Refer to the [Cluster API Book Glossary](https://cluster-api.sigs.k8s.io/reference/glossary.html).
56+
57+
## Summary
58+
59+
This proposal is for the support of Windows [OS](https://cluster-api.sigs.k8s.io/reference/glossary.html#operating-system) worker nodes in Cluster API and [infrastructure providers](https://cluster-api.sigs.k8s.io/reference/glossary.html#infrastructure-provider) that wish to support
60+
Windows. Cluster API will support Windows by using kubeadm to add Windows nodes to a [workload cluster](https://cluster-api.sigs.k8s.io/reference/glossary.html#workload-cluster).
61+
62+
Windows support has been stable in Kubernetes since 1.14 and is supported in clusters that run Linux for the
63+
Control Plane. The Worker nodes can be any combination of Windows or Linux.
64+
65+
Windows node support has some unique challenges because of the current limitations of Windows Containers.
66+
Windows containers do not support privileged operations which means that configuration and access to the host
67+
machine must be done at provisioning time.
68+
69+
An example of this limitation is how kube-proxy gets configured on Windows nodes. Kube-proxy typically runs as a
70+
Windows service on the host machine and it cannot be deployed as a DaemonSet as it is on Linux.
71+
To address this limitation the community has built tools such as the [CSI-Proxy](https://github.com/kubernetes-csi/csi-proxy), which is a CSI driver specific proxy.
72+
This proposal will address how to approach the configuration of components that are typically deployed as
73+
daemon sets when bootstrapping Windows nodes in CAPI.
74+
75+
## Motivation
76+
77+
Kubernetes has supported Windows workloads since the release of Windows support in Kubernetes 1.14. The
78+
motivation of this proposal is to enable Cluster API users to deploy Windows as part of a mixed OS cluster
79+
via the Cluster API automation built for platform operators. This will enable cluster operators to define
80+
Windows machines in the same consistent and repeatable fashion.
81+
82+
### Goals
83+
84+
- Enable the creation and management of Windows worker nodes on workload clusters by adding support via the Kubeadm bootstrap provider and infrastructure providers
85+
- Provide community guidance and scripts for building base images for Windows nodes
86+
- Re-use of the existing Cluster API Bootstrap Provider Kubeadm and other tools where appropriate
87+
88+
### Non-Goals/Future Work
89+
90+
- Provide a way to run [control plane](https://cluster-api.sigs.k8s.io/reference/glossary.html#control-plane) nodes as Windows
91+
- Support for Windows versions outside of the Kubernetes support versions
92+
- Support for Windows nodes on the [management](https://cluster-api.sigs.k8s.io/reference/glossary.html#management-cluster) or [bootstrap clusters](https://cluster-api.sigs.k8s.io/reference/glossary.html#bootstrap-cluster)
93+
- Provide a way to configure Windows nodes with non-Kubeadm based bootstrap providers
94+
95+
## Proposal
96+
97+
### Cluster API Bootstrap Provider Kubeadm
98+
99+
#### cloud-init and cloudbase-init
100+
101+
For Linux, when using the Kubeadm bootstrap provider, the bootstrap script is provided to the infrastructure provider as a cloud-init script.
102+
The infrastructure provider is responsible for putting the cloud-init script in the right location.
103+
When the VM is booted, the cloud-init script runs automatically.
104+
105+
Cloud-init does not have Windows support. An alternative product is [cloudbase-init](https://github.com/cloudbase/cloudbase-init).
106+
Cloudbase-init functions in the same way as cloud-init and can consume cloud-init scripts as provided by the Cluster API Bootstrap Provider Kubeadm.
107+
By using cloudbase-init, Windows can leverage the existing solutions and stay up to date with the latest changes in CABPK. Refer to the [cloudbase-init documentation](https://cloudbase-init.readthedocs.io/en/latest/intro.html) for features that are supported.
108+
109+
#### Image Creation
110+
111+
Using cloudbase-init requires the creation of an image with the tooling installed on it since it is not
112+
provided out of the box by any cloud providers. We'll provide packer scripts as part of
113+
the [image-builder project](https://github.com/kubernetes-sigs/image-builder) that pre-installs
114+
`cloudbase-init`. It is important to note that while scripts can be provided to build an image, all images
115+
built need to adhere to [Windows licensing requirements](https://www.microsoft.com/en-us/licensing/product-licensing/windows-server).
116+
117+
There is prior art for building Windows base images. For example, AKS-Engine has an example implementation for using packer and scripts to do image configuration: https://github.com/Azure/aks-engine/blob/master/vhd/packer/windows-vhd-builder.json.
118+
Another example is the the [sig-windows-tools](https://github.com/kubernetes-sigs/sig-windows-tools) which provide scripts for image configuration when using Kubeadm.
119+
120+
Although the Linux implementation in image-builder uses Ansible for configuration, Windows isn't going to share
121+
the same configuration because [Ansible](https://docs.ansible.com/ansible/latest/user_guide/windows.html) requires [Windows specific modules](https://docs.ansible.com/ansible/latest/modules/list_of_windows_modules.html) to do the configuration.
122+
123+
#### Kubelet and other component configuration
124+
125+
Due to the lack of privileged containers in Windows, a combination of `PreKubeadmCommands`/`PostKubeadmCommands`
126+
scripts and wins.exe can be used to configure the nodes. Wins.exe is currently provided as a way to bootstrap nodes along with kubeadm in the [Kubernetes documentation for adding Windows nodes](https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes/).
127+
The components from the [preparenode script](https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes/#joining-a-windows-worker-node) can be used during image creation.
128+
129+
In the future, when support for [Privileged Containers for Windows containers](https://github.com/kubernetes/enhancements/issues/1981) is merged, we might be able to revisit this proposal
130+
and use privileged containers in place of wins.exe enabled containers.
131+
132+
Each infrastructure providers must provide their own `PreKubeadmCommands`/`PostKubeadmCommands` scripts that
133+
are required for additional configuration for the node. During planning for Beta we will be able to identify
134+
common overlapping features that can be added into the the base images in image-builder and for re-use
135+
136+
#### netbios names
137+
138+
Cluster API currently generates the machine deployment name which can result in long machine names. This was a was concern for Netbios on Windows which requires Windows computer names to be 15 characters or fewer (https://support.microsoft.com/en-us/help/909264/naming-conventions-in-active-directory-for-computers-domains-sites-and).
139+
Attempting to set a hostname with more than 15 characters on a windows machine will result in only the first 15 being used.
140+
141+
The conclusion of the [issue](https://github.com/kubernetes-sigs/cluster-api/issues/2217) was NETBIOS name resolution is mostly unused today and is not required to join an AD domain since Windows 2000. If DNS is properly configured then the long host names generated by Cluster API will be usable.
142+
143+
### Infrastructure provider implementation
144+
145+
By leveraging cloudbase-init, an infrastructure provider implementation will require only a few changes which include:
146+
147+
- Make changes to their provider api to enable Windows OS infra machines ([example](https://github.com/ionutbalutoiu/cluster-api-provider-azure/commit/9c8daedac75959b141fec7ea909c2c1fd0bd484b))
148+
- Ensuring cloudbase-init is configured properly to read UserData which will contain the cloud-init script. Users must configure
149+
[cloudbase-init with a metadata service](https://cloudbase-init.readthedocs.io/en/latest/services.html#configuring-available-services) that has support for [UserData](https://cloudbase-init.readthedocs.io/en/latest/userdata.html) ([example](https://cloudbase-init.readthedocs.io/en/latest/tutorial.html#configuration-file)).
150+
151+
From the infrastructure provider perspective, there are no known required changes to the CAPI API to support Windows
152+
nodes at this time. If during alpha we identify changes we will open issues pertaining to the changes required.
153+
154+
### User Stories
155+
156+
#### As an operator, I would like to create Windows OS worker nodes with the CAPI API.
157+
158+
#### As an operator, I would like to manage Windows OS worker nodes with the CAPI API.
159+
160+
### Implementation Details/Notes/Constraints
161+
162+
Due to the lack of privileged containers in Windows there are two options for configuring the components such as
163+
kube-proxy, kubelet. The above solution using wins is preferred because it makes the move to privileged containers
164+
straightforward as a drop and replace.
165+
166+
While this is the best choice for the alpha and the community direction there are some infrastructure providers that may
167+
not be able to use wins due to signing or security concerns since wins allows the execution of any arbitrary command on
168+
the host. Pre/post commands can be used as an alternative with additional scripts cached on the image that enable the configuration.
169+
170+
#### Signing of the components.
171+
172+
Some infrastructure providers will require any scripts and binaries are signed before deployment.
173+
This will be managed by providing the ability to provide url's to override external scripts and binaries
174+
during the image building process. An example of how this is could be accomplished is in the Linux
175+
implementation is the [containerd_url](https://github.com/kubernetes-sigs/image-builder/blob/58a08a1a8241356bab4afb1c6d8d2fbb8ef54bcf/images/capi/packer/config/ansible-args.json). In this case, the
176+
`containerd_url` could point to a location that would contain a packaged with signed binaries from the infrastructure provider.
177+
178+
#### Known prototypes and prior work:
179+
180+
- https://github.com/adelina-t/cloudbase-init-capz-demo
181+
- https://github.com/benmoss/kubeadm-windows/tree/master/cluster-api-aws
182+
- https://github.com/microsoft/cluster-api-provider-azurestackhci
183+
184+
### Security Model
185+
186+
Wins.exe is currently the [recommended way to use kubeadm](https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes/).
187+
Limiting access to the named pipes that are required is one way to mitigate access. Wins is currently
188+
required during and after provisioning for running kube-proxy and the CNI daemonset.
189+
190+
The security model for Privileged containers is still being discussed in KEP and is still early. The security concerns for Privileged containers will be addresses in the Beta phase of this proposal after the Privileged containers KEP progresses.
191+
192+
Kubeadm bootstrap token should be able to use multi-part mime documents for cloudbase-init as done for [Linux in CAPA](https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/28d01d064cc2e5b0286ae23b3be7203f18b00447/controllers/awsmachine_controller.go#L601).
193+
This will require an update to Cloudbase-init which does support [mutli-part mime documents](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#multi-part-content) but is missing the [boothook](https://cloudinit.readthedocs.io/en/latest/topics/format.html?highlight=boothook#cloud-boothook) functionality.
194+
Support for cloudhooks can be added to cloudbase-init to meet the AWS provider requirement that
195+
would bring parity to Linux implementation during the Beta phase.
196+
197+
There is [no known requirement](https://github.com/kubernetes-sigs/cluster-api/issues/2218) for managing the Admin
198+
Kubeconfig or domain passwords in the Windows configuration. Domain passwords should be managed outside the scope of
199+
CAPI and only Kubeadm bootstrap tokens, which have limited lifetime, should be used for the joining the Windows nodes to the cluster.
200+
The joining of Windows nodes to a Domain Controller can be accomplished through pre/post kubeadm commands. Future support could be
201+
added via a separate controller that supports composable bootstrapping which is outside of the scope of this CAEP. Refer
202+
to issue [#3761](https://github.com/kubernetes-sigs/cluster-api/issues/3761) for more details.
203+
204+
### Risks and Mitigations
205+
206+
- Privileged containers are not implemented.
207+
- There is an active discussion and [KEP](https://docs.google.com/document/d/12EUtMdWFxhTCfFrqhlBGWV70MkZZPOgxw0X-LTR0VAo/edit#) in place. At the Beta stage the community can do a checkpoint to determine if the solution fits user needs
208+
- Cloudbase-init is a third party dependency
209+
- This project is under Apache 2.0 License : https://github.com/cloudbase/cloudbase-init which is cleared under the CNCF Allow list: https://github.com/cncf/foundation/blob/master/allowed-third-party-license-policy.md
210+
- Windows image Distribution
211+
- Infrastructure providers can provide the ability to use user provided images and images provided by image-promoter are recommended for testing and demonstration purposes. It is recommended the user creates their own image.
212+
- Users using the image scripts must ensure they are following [Windows licensing requirements](https://www.microsoft.com/en-us/licensing/product-licensing/windows-server)
213+
- Wins.exe is a third party dependency
214+
- The project is under the Apache 2.0 License
215+
216+
## Alternatives
217+
218+
1. An alternative to using wins.exe and DaemonSets to do the configuration to download and configure components as services
219+
using the kubeadm pre/post commands. This would require the infrastructure providers to have the ability to pass
220+
configuration through the use of these commands which is already done today. During the Alpha phase with the pre/post
221+
scripts being developed by individual infra providers this will not be an issue. With the move to Windows privileged
222+
containers in Beta, this becomes a non issue as wins will no longer be required.
223+
224+
1. Create a separate bootstrap provider for Windows. This would require re-implementing a lot of the logic that is
225+
already in CABPK.
226+
When bugs are fixed or changes in behavior occur, Windows would risk being out of sync with the Linux implementation.
227+
228+
1. Modified CABPK provider to have a different output format than cloud-init for Windows nodes. With Cloudbase-init
229+
there are no requirements to change CABPK which makes the adaption for Windows straightforward. If we were to adapt
230+
the output format of CABPK there is a potential for introduction of bugs and variation in the logic that would be
231+
created for Windows nodes. This would cause the Windows implementation to differ from others which could lead to
232+
confusion when debugging differences.
233+
234+
## Upgrade Strategy
235+
236+
Nodes that use this pattern will require the infrastructure to be immutable as specified by CAPI documentation.
237+
238+
## Additional Details
239+
240+
### Test Plan [optional]
241+
242+
**Note:** *Section not required until targeted at a release.*
243+
244+
There are no changes to CAPI core proposed at this time. End to end tests in CAPI test suit use [Kind](https://kind.sigs.k8s.io/) and
245+
Windows does not support Docker in Docker so end to end test can not be added for Windows specific behavior.
246+
If changes are required during development unit tests will be required.
247+
248+
For infrastructure providers the testing plan is left up to each infrastructure provider. It is recommended to leverage
249+
the existing upstream Kubernetes Windows tests to show that Windows nodes are operating effectively.
250+
251+
### Graduation Criteria [optional]
252+
253+
**Note:** *Section not required until targeted at a release.*
254+
255+
#### Alpha
256+
- `PreKubeadmCommands`/`PostKubeadmCommands` command scripts are created per infrastructure provider if required
257+
- Initially implemented with wins.exe
258+
- Windows Packer scripts to create image with cloudbase-init added to the image builder scripts
259+
260+
#### Beta
261+
- Pre/Post commands moved to bootstrap provider if identified as re-usable
262+
- Adopt privileged containers (dependant on Privileged containers KEP)
263+
- kubeadm bootstrap token can be kept secret via multi-part mime documents for cloudbase-init.
264+
265+
#### Stable
266+
Use of privileged containers.
267+
268+
### Version Skew Strategy
269+
270+
The version of support for the Windows operating system is outside the scope of cluster creation. Please refer
271+
to the Kubernetes Windows documentation for the latest version skew support, features, and functionality.
272+
273+
## Implementation History
274+
275+
- [X] 01/29/2020: Proposed idea in an issue
276+
- https://github.com/kubernetes-sigs/cluster-api/issues/2218
277+
- https://github.com/kubernetes-sigs/cluster-api-provider-azure/issues/153
278+
- [X] 08/17/2020: Compile a Google Doc following the CAEP template
279+
- https://docs.google.com/document/d/14evDl_3RgEFfchmgPzNw6lb1vIttN_Hb9333UnUJ734/edit
280+
- [X] 08/31/2020: First round of feedback from community
281+
- [X] 08/25/2020: Present proposal at a [community meeting]
282+
- [X] 09/09/2020: Open proposal PR
283+
284+
<!-- Links -->
285+
[community meeting]: https://docs.google.com/document/d/1fQNlqsDkvEggWFi51GVxOglL2P1Bvo2JhZlMhm2d-Co/edit#heading=h.ozawn3ogj91o
286+

0 commit comments

Comments
 (0)