嵌套虚拟化

虚拟机管理软件:exsi 6.7,
k8s node节点: ubuntu 18.04.5 desktop, k8s 1.18.20。

Dockerfile

进入 windows7下载目录(此目录应当只有一个iso)构建镜像

cd /media/sf_backup/dev/os/windows10-20h2cat <<EOF | sudo tee Dockerfile
FROM scratch
ADD --chown=107:107 cn_windows_10_business_editions_version_20h2_updated_april_2021_x64_dvd_0a0fc490.iso /disk/
EOFdocker build -t win10:20h2 .

win10-c-sysprep.yaml

apiVersion: v1
kind: ConfigMap
metadata:name: win10-configmap
data:autounattend.xml: |-<?xml version="1.0" encoding="utf-8"?><unattend xmlns="urn:schemas-microsoft-com:unattend"><settings pass="windowsPE"><component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"><SetupUILanguage><UILanguage>en-US</UILanguage></SetupUILanguage><InputLocale>0409:00000409</InputLocale><SystemLocale>en-US</SystemLocale><UILanguage>en-US</UILanguage><UILanguageFallback>en-US</UILanguageFallback><UserLocale>en-US</UserLocale></component><component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"><DriverPaths><PathAndCredentials wcm:keyValue="4b29ba63" wcm:action="add"><Path>E:\amd64\w10</Path></PathAndCredentials><PathAndCredentials wcm:keyValue="25fe51ea" wcm:action="add"><Path>E:\viostor\w10\amd64</Path></PathAndCredentials></DriverPaths></component><component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"><DiskConfiguration><Disk wcm:action="add"><CreatePartitions><CreatePartition wcm:action="add"><Order>1</Order><Type>Primary</Type><Size>100</Size></CreatePartition><CreatePartition wcm:action="add"><Extend>true</Extend><Order>2</Order><Type>Primary</Type></CreatePartition></CreatePartitions><ModifyPartitions><ModifyPartition wcm:action="add"><Format>NTFS</Format><Label>System Reserved</Label><Order>1</Order><PartitionID>1</PartitionID><TypeID>0x27</TypeID></ModifyPartition><ModifyPartition wcm:action="add"><Format>NTFS</Format><Label>OS</Label><Letter>C</Letter><Order>2</Order><PartitionID>2</PartitionID></ModifyPartition></ModifyPartitions><DiskID>0</DiskID><WillWipeDisk>true</WillWipeDisk></Disk></DiskConfiguration><ImageInstall><OSImage><InstallFrom><MetaData wcm:action="add"><Key>/Image/Description</Key><Value>Windows 10 Pro</Value></MetaData></InstallFrom><InstallTo><DiskID>0</DiskID><PartitionID>2</PartitionID></InstallTo></OSImage></ImageInstall><UserData><AcceptEula>true</AcceptEula><FullName/><Organization/><ProductKey><Key/></ProductKey></UserData></component></settings><settings pass="offlineServicing"><component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"><EnableLUA>false</EnableLUA></component></settings><settings pass="specialize"><component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"><InputLocale>0409:00000409</InputLocale><SystemLocale>en-US</SystemLocale><UILanguage>en-US</UILanguage><UILanguageFallback>en-US</UILanguageFallback><UserLocale>en-US</UserLocale></component><component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"><SkipAutoActivation>true</SkipAutoActivation></component><component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-SQMApi" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"><CEIPEnabled>0</CEIPEnabled></component></settings><settings pass="oobeSystem"><component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"><OOBE><HideEULAPage>true</HideEULAPage><HideOEMRegistrationScreen>true</HideOEMRegistrationScreen><HideOnlineAccountScreens>true</HideOnlineAccountScreens><HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE><NetworkLocation>Work</NetworkLocation><SkipUserOOBE>true</SkipUserOOBE><SkipMachineOOBE>true</SkipMachineOOBE><ProtectYourPC>3</ProtectYourPC></OOBE><AutoLogon><Password><Value>123456</Value><PlainText>true</PlainText></Password><Enabled>true</Enabled><Username>Administrator</Username></AutoLogon><UserAccounts><AdministratorPassword><Value>123456</Value><PlainText>true</PlainText></AdministratorPassword></UserAccounts><RegisteredOrganization/><RegisteredOwner/><TimeZone>China Standard Time</TimeZone><FirstLogonCommands><SynchronousCommand wcm:action="add"><CommandLine>powershell -ExecutionPolicy Bypass -NoExit -NoProfile f:\post-install.ps1</CommandLine><RequiresUserInput>false</RequiresUserInput><Order>1</Order><Description>Post Installation Script</Description></SynchronousCommand></FirstLogonCommands></component></settings></unattend>post-install.ps1: |-# Remove AutoLogin# https://docs.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-autologon-logoncount#logoncount-known-issuereg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f# install Qemu Tools (Drivers)#Start-Process msiexec -Wait -ArgumentList '/i e:\virtio-win-gt-x64.msi /qn /passive /norestart'# install Guest Agent#Start-Process msiexec -Wait -ArgumentList '/i e:\guest-agent\qemu-ga-x86_64.msi /qn /passive /norestart'# Rename cached unattend.xml to avoid it is picked up by sysprepmv C:\Windows\Panther\unattend.xml C:\Windows\Panther\unattend.install.xml# Eject CD, to avoid that the autounattend.xml on the CD is picked up by sysprep(new-object -COM Shell.Application).NameSpace(17).ParseName('F:').InvokeVerb('Eject')# Run Sysprep and ShutdownC:\Windows\System32\Sysprep\sysprep.exe /generalize /oobe /shutdown /mode:vm#C:\Windows\System32\Sysprep\sysprep.exe /generalize /oobe /shutdown---metadata:name: w10-c
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachineInstance
spec:domain:clock:timezone: "Asia/Shanghai"utc: {}timer: {}cpu:sockets: 4cores: 1threads: 1features:acpi: {}apic: {}hyperv:relaxed: {}vapic: {}vpindex: {}spinlocks:spinlocks: 8191resources:requests:memory: 4096Mcpu: 4devices:#blockMultiQueue: trueinputs:- type: tabletbus: usb#bus: virtioname: tablet1disks:- name: rootdiskbootOrder: 1disk:bus: virtio- name: containerdiskbootOrder: 2cdrom:bus: sata- name: virtiocontainerdiskbootOrder: 3cdrom:bus: sata- name: sysprepbootOrder: 4cdrom:bus: satainterfaces:- name: defaultmodel: e1000masquerade: {}networks:- name: defaultpod: {}volumes:- name: containerdiskcontainerDisk:image: win10:20h2- name: rootdiskhostDisk:capacity: 30Gipath: /data/vm/win1001/disk.imgtype: DiskOrCreate- name: virtiocontainerdiskcontainerDisk:image: kubevirt/virtio-container-disk:v0.37.0- name: sysprepsysprep:configMap:name: win10-configmap

执行命令创建vmi

kubectl create -f win10-c-sysprep.yaml

vmi running 状态后,连接vnc界面,进行安装(此unattend.xml 有些不对,需要人工选择语言)

virtctl vnc w10-c

win10-c-ok.yaml

apiVersion: v1
kind: ConfigMap
metadata:name: win10-ok-configmap
data:autounattend.xml: |-<?xml version="1.0" encoding="utf-8"?><!-- responsible for installing windows, ignored on sysprepped images -->unattend.xml: |-<?xml version="1.0" encoding="utf-8"?><unattend xmlns="urn:schemas-microsoft-com:unattend"><settings pass="oobeSystem"><component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"><OOBE><HideEULAPage>true</HideEULAPage><HideOEMRegistrationScreen>true</HideOEMRegistrationScreen><HideOnlineAccountScreens>true</HideOnlineAccountScreens><HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE><NetworkLocation>Work</NetworkLocation><SkipUserOOBE>true</SkipUserOOBE><SkipMachineOOBE>true</SkipMachineOOBE><ProtectYourPC>3</ProtectYourPC></OOBE><AutoLogon><Password><Value>123456</Value><PlainText>true</PlainText></Password><Enabled>true</Enabled><Username>Administrator</Username></AutoLogon><UserAccounts><AdministratorPassword><Value>123456</Value><PlainText>true</PlainText></AdministratorPassword></UserAccounts><RegisteredOrganization>Kuebvirt</RegisteredOrganization><RegisteredOwner>Kubevirt</RegisteredOwner><TimeZone>Eastern Standard Time</TimeZone><FirstLogonCommands><SynchronousCommand wcm:action="add"><CommandLine>powershell -ExecutionPolicy Bypass -NoExit -WindowStyle Hidden -NoProfile f:\setup.ps1</CommandLine><RequiresUserInput>false</RequiresUserInput><Order>1</Order><Description>Customize Script</Description></SynchronousCommand></FirstLogonCommands><LogonCommands><AsynchronousCommand wcm:action="add"><CommandLine>powershell -ExecutionPolicy Bypass -NoExit -WindowStyle Hidden -NoProfile f:\setup.ps1</CommandLine><RequiresUserInput>false</RequiresUserInput><Order>1</Order><Description>Customize Script</Description></AsynchronousCommand></LogonCommands></component></settings></unattend>setup.ps1: |-date >> C:\Users\Administrator\Desktop\tmp.txt#after install nfs client, uncomment next 1 line#$r = (cmd /c mount \\192.88.1.190\data s:)---metadata:name: w10-c
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachineInstance
spec:domain:clock:timezone: "Asia/Shanghai"utc: {}timer: {}cpu:sockets: 4cores: 1threads: 1features:acpi: {}apic: {}hyperv:relaxed: {}vapic: {}vpindex: {}spinlocks:spinlocks: 8191resources:requests:memory: 4096Mcpu: 4devices:blockMultiQueue: trueinputs:- type: tabletbus: usb#bus: virtioname: tablet1disks:- name: rootdiskbootOrder: 1disk:bus: virtio- name: containerdiskbootOrder: 2cdrom:bus: sata- name: virtiocontainerdiskbootOrder: 3cdrom:bus: sata- name: sysprepbootOrder: 4cdrom:bus: satainterfaces:- name: defaultmodel: e1000masquerade: {}networks:- name: defaultpod: {}volumes:- name: containerdiskcontainerDisk:image: win10:20h2- name: rootdiskhostDisk:capacity: 30Gipath: /data/vm/win1001/disk.imgtype: DiskOrCreate- name: virtiocontainerdiskcontainerDisk:image: kubevirt/virtio-container-disk:v0.37.0- name: sysprepsysprep:configMap:name: win10-ok-configmap

按照 win10-c-sysprep.yaml 安装好windows 10 后,再使用此配置重新配置操作系统,此会自动登录,并且执行登录后的启动脚本。
注意:
(1)第一次用此yaml安装,要配置系统,较慢。以后启动很快。
(2)上面的登录后启动脚本,mount nfs服务,需要在启动系统,打开windows10 nfs客户端功能后,再放开注释

k8s 1.18.20 kubevirt v0.47.1 创建 windows10 虚拟机相关推荐

  1. K8S 1.18.0 以及KubeEdge 1.10.3 三机安装部署(含过程记录及遇到的报错和解决方法)

    因为网络上大多数教程只有部署相关的命令,而无输入命令后正确界面的显示样例,因此在参考网络上教程并跟随实现的过程中,我将过程进行截图记录,供大家参考.希望对大家有帮助~ 一. K8S部署 选用了三台虚拟 ...

  2. Fedora 15 16 17 18 20无线网卡驱动安装

    Fedora 15 16 17 18 20无线网卡驱动安装 一直不想在虚拟机中安装使用系统,然后就打算给自己的电脑安装一个双系统,因对Fedora有比较好的印象,也就还是选用了它作为我的第二系统.废话 ...

  3. K8s 1.18 正式 release | 云原生生态周报 Vol. 43

    作者 | 汪萌海. 王思宇 业界要闻 K8s 1.18 正式 release Kubernetes1.18 版本发布! 一些将对社区产生影响的新特性日渐完善,如 KSA(Kubernetes Serv ...

  4. 重磅!K8S 1.18版本将内置支持SideCar容器。

    作者:justmine 头条号:大数据与云原生 微信公众号:大数据与云原生 创作不易,在满足创作共用版权协议的基础上可以转载,但请以超链接形式注明出处. 为了方便阅读,微信公众号已按分类排版,后续的文 ...

  5. 2016年10月9日 星期日 --出埃及记 Exodus 18:20

    2016年10月9日 星期日 --出埃及记 Exodus 18:20 Teach them the decrees and laws, and show them the way to live an ...

  6. 部署k8s 1.18版本及图形管理工具kuboard(十四)

    部署k8s 1.18版本 1.配置主机名 [root@192 ~]# hostnamectl set-hostname k8s-master [root@192 ~]# hostnamectl set ...

  7. 部署k8s时ssh端口不是22导致创建ssh session failed问题

    项目场景:部署k8s时ssh端口不是22导致创建ssh session failed问题 (SHH端口代理) 项目场景:部署k8s,日志显示错误不能创建ssh连接错误,由于主机服务器配置的ssh端口为 ...

  8. 《Java编码指南:编写安全可靠程序的75条建议》—— 指南20:使用安全管理器创建一个安全的沙盒...

    本节书摘来异步社区<Java编码指南:编写安全可靠程序的75条建议>一书中的第1章,第1.20节,作者:[美]Fred Long(弗雷德•朗), Dhruv Mohindra(德鲁•莫欣达 ...

  9. 在笔记本上安装 linux系统--Ubuntu 20.04(实体机安装而非虚拟机)

    在笔记本上安装 linux系统–Ubuntu 20.04(实体机安装而非虚拟机) 一.刻录操作系统镜像到U盘 Ubuntu有详细的操作说明(5分钟左右能看完)大概如下 Create a bootabl ...

  10. kubeadm部署安装k8s v1.18.1详解

    1.文章经常遇到bug问题的地方保持返回输出,方便您的理解. 2.为方便您的复制粘贴,无返回输出以及简单返回输出的命令前无标识符,有返回输出的命令前以"$"标识. 3.为方便你的深 ...

最新文章

  1. Lilt:一个为翻译专家开发的人工智能翻译平台
  2. SQL Server 学习系列之五
  3. 4.13 apache用户认证,跳转和访问日志
  4. python float字节数_float型的数在内存中的表示 附:python3解析函数 | 学步园
  5. POJ - 3250 Bad Hair Day(单调队列/单调栈)
  6. DataGrip汉化方法
  7. Mybatis的查询、关联查询
  8. linux box 黑屏,在linux16.04上安装virturalbox的时候出现问题
  9. 小i机器人伴侣_【数据分析】2020年3月全国工业机器人产量统计数据分析
  10. Embedded ProC(嵌入式ProC)与Tuxedo中间件
  11. cad转dxf格式文件太大_DWG格式怎么转换成DXF格式?实测好用的转换工具都在这了...
  12. 学习笔记(三):WiFi-Sleep
  13. Unity Sprite 灰色图
  14. 小厮吃货:智能便利店不是新零售的风口?!
  15. HTML hr 标签的用法
  16. web scraper
  17. 推荐3个游戏小程序,让你整个暑假都充实!
  18. CentOs7 安装绿色版Nginx并配置开机启动
  19. ZBT的计算几何模板
  20. l2tp vpn server搭建教程

热门文章

  1. 交换机级联,堆叠,集群技术介绍
  2. 语义漂移_当概念漂移是语义漂移时
  3. threejs修改模型旋转轴
  4. android中如何让动画停止,让Android AnimatorSet停止制作动画
  5. ACM——01——1003: 【入门】求任意三位数各个数位上数字的和 【运算符】
  6. 微信公众号调取相册和摄像头功能,实现图片上传
  7. Android笔记:自定义锁屏
  8. 《近匠》 | 探索一站式智能硬件开发的最佳解决方案
  9. was部署项目启动显示[jcc][t4][10275][10041][3.63.123]ccsid 编码或语言环境不受支持:“Cp1386”. errorcode=-4220 sqlstate=220
  10. hihoCoder 1425 : What a Beautiful Lake(美丽滴湖)