Skip to content

Windows 2019 - default gateway not configured #932

@lupstor

Description

@lupstor

What steps did you take and what happened?

I'm having issues when trying to provision a Windows 2019 VM, the network configuration is not set correctly when applying the yaml config below. I did not pre-run sysprep according to this article recommendation.

apiVersion: v1
kind: Secret
metadata:
  name: herber-windows-vm-boostrap-data-v5
stringData:
  unattend: |
    <?xml version="1.0" encoding="UTF-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="windowsPE">
        <component name="Microsoft-Windows-Setup" processorArchitecture="amd64"
                   publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
                   xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <UserData>
                <AcceptEula>true</AcceptEula>
                <FullName>jdoe</FullName>
                <Organization>VMware</Organization>
                <ProductKey>
                    <Key>my-key</Key>
                    <WillShowUI>Never</WillShowUI>
                </ProductKey>
            </UserData>
        </component>
    </settings>
    <settings pass="specialize">
        <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64"
              publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
              xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <Interfaces>
            <Interface wcm:action="add">
              <Ipv4Settings>
                <DhcpEnabled>false</DhcpEnabled>
              </Ipv4Settings>
              <Ipv6Settings>
                <DhcpEnabled>false</DhcpEnabled>
              </Ipv6Settings>
              <Identifier>{{ V1alpha1_FirstNicMacAddr }}</Identifier>
              <UnicastIpAddresses>
                <IpAddress wcm:action="add" wcm:keyValue="1">{{ V1alpha1_FirstIP }}</IpAddress>
              </UnicastIpAddresses>
              <Routes>
                <Route wcm:action="add">
                  <Identifier>0</Identifier>
                  <Metric>10</Metric>
                  <NextHopAddress>{{ (index .V1alpha1.Net.Devices 0).Gateway4 }}</NextHopAddress>
                  <Prefix>{{ V1alpha1_SubnetMask V1alpha1_FirstIP }}</Prefix>
                </Route>
              </Routes>
            </Interface>
          </Interfaces>
        </component>
        <component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64"
          publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
          xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <Interfaces>
            <Interface wcm:action="add">
              <Identifier>{{ V1alpha1_FirstNicMacAddr }}</Identifier>
              <DNSServerSearchOrder> {{ range .V1alpha1.Net.Nameservers }} <IpAddress
                  wcm:action="add"
                  wcm:keyValue="{{.}}"></IpAddress> {{ end }} </DNSServerSearchOrder>
            </Interface>
          </Interfaces>
        </component>
        <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64"
                   publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
                   xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Path>C:\sysprep\guestcustutil.exe restoreMountedDevices</Path>
                    <Order>1</Order>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Path>C:\sysprep\guestcustutil.exe flagComplete</Path>
                    <Order>2</Order>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Path>C:\sysprep\guestcustutil.exe deleteContainingFolder</Path>
                    <Order>3</Order>
                </RunSynchronousCommand>
            </RunSynchronous>
        </component>
    </settings>
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35"
                   language="neutral" versionScope="nonSxS"
                   xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <AutoLogon>
                <Password>
                    <Value>$Password44</Value>
                    <PlainText>true</PlainText>
                </Password>
                <Enabled>true</Enabled>
                <Username>Administrator</Username>
            </AutoLogon>
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                <NetworkLocation>Work</NetworkLocation>
                <ProtectYourPC>1</ProtectYourPC>
                <SkipMachineOOBE>true</SkipMachineOOBE>
                <SkipUserOOBE>true</SkipUserOOBE>
            </OOBE>
            <RegisteredOrganization>Organization</RegisteredOrganization>
            <RegisteredOwner>Owner</RegisteredOwner>
            <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
            <TimeZone>Central America Standard Time</TimeZone>
            <UserAccounts>
                <AdministratorPassword>
                    <Value>$MyPasss</Value>
                    <PlainText>true</PlainText>
                </AdministratorPassword>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Description>devtest</Description>
                        <DisplayName>devtest</DisplayName>
                        <Group>Administrators</Group>
                        <Name>devtest</Name>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
        </component>
    </settings>
    </unattend>
---
apiVersion: vmoperator.vmware.com/v1alpha2
kind: VirtualMachine
metadata:
  name:      herber-windows-vm
  labels:
    app.kubernetes.io/name: herber-windows-vm
spec:
  className:    best-effort-small
  imageName:    vmi-a599cebbaddc59d93
  storageClass: vsan-default-storage-policy
  bootstrap:
    sysprep:
      rawSysprep:
        name: herber-windows-vm-boostrap-data-v5
        key: unattend
---
apiVersion: vmoperator.vmware.com/v1alpha2
kind: VirtualMachineService
metadata:
  name: herber-windows-vm-service
spec:
  type: LoadBalancer
  selector:
    app.kubernetes.io/name: herber-windows-vm
  ports:
    - protocol: TCP
      port: 3389
      name: rdp
      targetPort: 3389

Image

What did you expect to happen?

Network configuration is set correctly.

Is there anything else you would like to add?
Here I share a public folder with the following:

  • VM yaml Configuration
  • VM K8s object output.
  • Sysprep logs
  • Unnatended file generated in windows

Please tell us about your environment.

Value How to Obtain
Supervisor version v1.29.7+vmware.1-fips-vsc0.1.10-24224934 rpm -qa VMware-wcp on the vCenter appliance
Supervisor node image version rpm -qa VMware-wcpovf on the vCenter appliance
Kubernetes version v1.29.7+vmware.wcp.1 kubectl version
VM Operator version 0.1.0-59f178f-1.8.6-010e27a-24170237
kubectl -n vmware-system-vmop get pods \
  -ojsonpath='{range .items[*].spec.containers[*]}{.image}{"\n"}{end}' | \
  sort -u | \
  grep vmop | \
  awk -F'/' '{print $3}' | \
  awk -F: '{print $2}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions