You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/creating-the-vsphere-windows-vm-golden-image.adoc
+63-61Lines changed: 63 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,81 +9,90 @@ Create a vSphere Windows virtual machine (VM) golden image.
9
9
10
10
.Prerequisites
11
11
12
-
* You have installed a cluster on vSphere configured with hybrid networking using OVN-Kubernetes.
13
-
* You have defined a custom VXLAN port in your hybrid networking configuration to work around the link:https://docs.microsoft.com/en-us/virtualization/windowscontainers/kubernetes/common-problems#pod-to-pod-connectivity-between-hosts-is-broken-on-my-kubernetes-cluster-running-on-vsphere[pod-to-pod connectivity issue between hosts].
12
+
* You have created a private/public key pair, which is used to configure key-based authentication in the OpenSSH server. The private key must also be configured in the Windows Machine Config Operator (WMCO) namespace. This is required to allow the WMCO to communicate with the Windows VM. See the "Configuring a secret for the Windows Machine Config Operator" section for more details.
14
13
15
-
.Procedure
16
-
17
-
. Create the VM from an updated version of the Windows Server 1909 VM image that includes the link:https://support.microsoft.com/en-us/help/4565351/windows-10-update-kb4565351[Microsoft patch KB4565351]. This patch is required to set the VXLAN UDP port, which is required for clusters installed on vSphere. This patch is not available for the `Windows Server 2019` VM image.
14
+
[NOTE]
15
+
====
16
+
You must use link:https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell[Microsoft PowerShell] commands in several cases when creating your Windows VM. PowerShell commands in this guide are distinguished by the `PS C:\>` prefix.
17
+
====
18
18
19
-
. Create the `C:\Users\Administrator\.ssh\authorized_keys` file in the Windows VM containing the public key that corresponds to the private key that resides in the secret you created in the `openshift-windows-machine-config-operator` namespace. The private key of the secret was created when first installing the Windows Machine Config Operator (WMCO) to give {product-title} access to Windows VMs. The `authorized_keys` file is used to configure SSH in the Windows VM.
19
+
.Procedure
20
20
21
-
. Configure SSH on the Windows VM by running the following Powershell script:
22
-
+
23
-
[source,posh]
24
-
----
25
-
# Powershell script to configure SSH on vSphere Windows VMs
. Create a new VM in the vSphere client using the Windows Server Semi-Annual Channel (SAC): Windows Server 2004 ISO image that includes the link:https://support.microsoft.com/en-us/help/4565351/windows-10-update-kb4565351[Microsoft patch KB4565351]. This patch is required to set the VXLAN UDP port, which is required for clusters installed on vSphere. See the link:https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.hostclient.doc/GUID-FBEED81C-F9D9-4193-BDCC-CC4A60C20A4E.html[VMware documentation] for more information.
47
22
48
23
. Install and configure VMware Tools version 11.0.6 or greater on the Windows VM. See the link:https://docs.vmware.com/en/VMware-Tools/index.html[VMware Tools documentation] for more information.
49
24
50
25
. After installing VMware Tools on the Windows VM, verify the following:
51
-
.. The `C:\ProgramData\VMware\VMware Tools\tools.conf` file has the following entry:
26
+
27
+
.. The `C:\ProgramData\VMware\VMware Tools\tools.conf` file exists with the following entry:
52
28
+
53
29
[source,ini]
54
30
----
55
31
exclude-nics=
56
32
----
57
33
+
58
-
This entry ensures the following:
34
+
If the `tools.conf` file does not exist, create it with the `exclude-nics` option uncommented and set as an empty value.
35
+
+
36
+
This entry ensures the cloned vNIC generated on the Windows VM by the hybrid-overlay is not ignored.
37
+
38
+
.. The Windows VM has a valid IP address in vCenter:
. Install and configure the OpenSSH Server on the Windows VM. See Microsoft's documentation on link:https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse[installing OpenSSH] for more details.
53
+
54
+
. Set up SSH access for an administrative user. See Microsoft's documentation on the link:https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement#administrative-user[Administrative user] to do this.
59
55
+
60
-
* The cloned vNIC generated on the Windows VM by the hybrid-overlay is not ignored.
61
-
* The VM has an IP address in vCenter.
56
+
[IMPORTANT]
57
+
====
58
+
The public key used in the instructions must correspond to the private key you create later in the WMCO namespace that holds your secret. See the "Configuring a secret for the Windows Machine Config Operator" section for more details.
59
+
====
62
60
63
-
.. The VMTools Windows service is running.
61
+
. Install the `docker` container runtime on your Windows VM following the link:https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-Server[Microsoft documentation].
62
+
63
+
. You must create a new firewall rule in the Windows VM that allows incoming connections for container logs. Run the following PowerShell command to create the firewall rule on TCP port 10250:
. Pull all of the required Windows container base images needed for your applications. The images you pull
66
-
are dependent on the Windows kernel you are using. See Microsoft's documentation on link:https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-base-images[pulling Windows container base images] for more information.
70
+
. Clone the Windows VM so it is a reusable image. Follow the VMware documentation on how to link:https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-1E185A80-0B97-4B46-A32B-3EF8F309BEED.html[clone an existing virtual machine] for more details.
67
71
68
-
. Run the link:+++https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/sysprep--generalize--a-windows-installation+++[Windows Sysprep tool] on the Windows VM:
72
+
. In the cloned Windows VM, run the link:+++https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/sysprep--generalize--a-windows-installation+++[Windows Sysprep tool]:
An example `unattend.xml` is provided, which maintains all the changes needed for the WMCO. For example, the `unattend.xml` file must ensure the Administrator's home directory stays intact with the SSH public key. You must customize the example to fit your needs.
80
+
[NOTE]
81
+
====
82
+
There is a limit on how many times you can run the `sysprep` command on a Windows image. Consult Microsoft's link:+++https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/sysprep--generalize--a-windows-installation#limits-on-how-many-times-you-can-run-sysprep+++[documentation] for more information.
83
+
====
84
+
+
85
+
An example `unattend.xml` is provided, which maintains all the changes needed for the WMCO. You must modify this example; it cannot be used directly.
76
86
+
77
87
.Example `unattend.xml`
78
88
[%collapsible]
79
89
====
80
90
[source,xml]
81
91
----
82
92
<?xml version="1.0" encoding="UTF-8"?>
83
-
<!--A sample unattend.xml which helps in setting admin password and running scripts on first boot-->
@@ -128,20 +131,19 @@ An example `unattend.xml` is provided, which maintains all the changes needed fo
128
131
<TimeZone>Eastern Standard Time</TimeZone>
129
132
<UserAccounts>
130
133
<AdministratorPassword>
131
-
<Value>MyPassword</Value>
134
+
<Value>MyPassword</Value> <3>
132
135
<PlainText>true</PlainText>
133
136
</AdministratorPassword>
134
-
<LocalAccounts>
135
-
<LocalAccount wcm:action="add">
136
-
<Description>Administrator</Description>
137
-
<DisplayName>Administrator</DisplayName>
138
-
<Group>Administrators</Group>
139
-
<Name>Administrator</Name>
140
-
</LocalAccount>
141
-
</LocalAccounts>
142
137
</UserAccounts>
143
138
</component>
144
139
</settings>
145
140
</unattend>
146
141
----
142
+
<1> Specify the `ComputerName`, which must follow the link:https://kubernetes.io/docs/concepts/overview/working-with-objects/names[Kubernetes' names specification]. These specifications also apply to Guest OS customization performed on the resulting template while creating new VMs.
143
+
<2> Disable the automatic logon to avoid the security issue of leaving an open terminal with Administrator privileges at boot. This is the default value and must not be changed.
144
+
<3> Replace the `MyPassword` placeholder with the password for the Administrator account. This prevents the built-in Administrator account from having a blank password by default. Follow Microsoft's link:https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/password-must-meet-complexity-requirements[best practices for choosing a password].
147
145
====
146
+
+
147
+
After the Sysprep tool has completed, the Windows VM will power off. You must not use or power on this VM anymore.
148
+
149
+
. Convert the Windows VM to link:https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-5B3737CC-28DB-4334-BD18-6E12011CDC9F.html[a template in vCenter].
<2> Specify the Windows machine set name. The machine set name cannot be more than 9 characters long, due to the way machine names are generated in vSphere.
68
68
<3> Configure the machine set as a Windows machine.
69
69
<4> Configure the Windows node as a compute machine.
70
-
<5> Specify the vSphere VM network to deploy the machine set to.
71
-
<6> Specify the full path of the Windows vSphere VM template to use, such as `/Datacenter/vm/ocp4-llplx/windows-golden-image`. The name must be unique.
70
+
<5> Specify the vSphere VM network to deploy the machine set to. This VM network must be where other Linux compute machines reside in the cluster.
71
+
<6> Specify the full path of the Windows vSphere VM template to use, such as `golden-images/windows-server-template`. The name must be unique.
72
72
+
73
73
[IMPORTANT]
74
74
====
75
-
Do not specify the original VM template. The VM template must remain off and must be cloned for new {op-system} machines. Starting the VM template configures the VM template as a VM on the platform, which prevents it from being used as a template that machine sets can apply configurations to.
76
-
//This admonition note also appears in `modules/installation-vsphere-machines.adoc`.
75
+
Do not specify the original VM template. The VM template must remain off and must be cloned for new Windows machines. Starting the VM template configures the VM template as a VM on the platform, which prevents it from being used as a template that machine sets can apply configurations to.
77
76
====
78
77
+
79
78
<7> The `windows-user-data` is created by the WMCO when the first Windows machine is configured. After that, the `windows-user-data` is available for all subsequent machine sets to consume.
You must prepare your vSphere environment for Windows container workloads by creating the vSphere Windows VM golden image and enabling communication with the internal API server for the WMCO.
* xref:../../windows_containers/enabling-windows-container-workloads.adoc#configuring-secret-for-wmco_enabling-windows-container-workloads[Configuring a secret for the Windows Machine Config Operator]
0 commit comments