{"id":33616,"date":"2015-09-17T16:55:52","date_gmt":"2015-09-17T13:55:52","guid":{"rendered":"http:\/\/cloudbase.it\/?p=33616"},"modified":"2015-09-25T17:15:57","modified_gmt":"2015-09-25T14:15:57","slug":"openstack-windows-nano-server","status":"publish","type":"post","link":"https:\/\/cloudbase.it\/openstack-windows-nano-server\/","title":{"rendered":"OpenStack + Windows Nano Server"},"content":{"rendered":"
What makes Nano Server special?<\/p>\n
How is this possible?<\/p>\n
In short, the OS has been stripped from everything that is not needed in a cloud environment, in particular the GUI stack, the x86 subsystem (WOW64), MSI installer support and unnecessary API.<\/p>\n
Nano Server and OpenStack are a perfect match in multiple scenarios, including:<\/p>\n
Nano can be deployed on OpenStack like any other Windows or Linux guest OS. Currently it supports Hyper-V compute nodes, with KVM and other hypervisors as soon as drivers become available. Bare metal deployments using Ironic or MaaS are also supported.<\/p>\n
Like in any other Linux or Windows instance case, a guest boot agent is required to take advantage of the OpenStack infrastructure.<\/p>\n
I’m glad to announce that Cloudbase-Init<\/a> is now fully supported on Nano Server!<\/strong><\/p>\n Creating a Nano OpenStack image is easy and as usual we open sourced the scripts<\/a> required to do that.<\/p>\n Disclaimer: please consider that Nano Server is still in technical preview, so things can change before the final release.<\/span><\/p>\n At the time of this writing the latest public available Nano Server install image can be obtained as part of the Windows Server 2016 TP3 ISO<\/strong>, available for download here<\/a>.<\/p>\n The following steps need to be executed using PowerShell on Windows, we tested them on Windows 10, Windows Server 2016 TP3 and Hyper-V Server 2012 R2.<\/p>\n Let’s start by cloning our git scripts repository, checking out the nano-server-support<\/em> branch:<\/p>\n The following variables need to match your environment, in particular the folder where you’d like to put the generated Nano VHDX image, the location of your Windows Server 2016 technical preview ISO and the password to assign to the Administrator<\/em> user. Please note that this password is only meant for troubleshooting and not for OpenStack tenants (more on this later).<\/p>\n We can now build our Nano Server image:<\/p>\n Download Cloudbase-Init:<\/p>\n Install Cloudbase-Init and prepare the image for OpenStack:<\/p>\n Done!<\/p>\n We’re ready to upload our freshly built image in Glance:<\/p>\n If you don’t have Hyper-V nodes in your OpenStack environment, adding one is very easy<\/a>. If you also don’t have an OpenStack deployment at hand, you can have one installed on your Windows server or laptop in a matter of minutes using v-magine<\/a>.<\/p>\n Nano instances can be booted on OpenStack like any other OS, with one exception: Nano does not currently support DVDRom drives, so if you plan to use ConfigDrive, Nova compute on Hyper-V must be set to use RAW disks (ISO or VFAT).<\/p>\n Here’s a simple nova boot example, where $netId<\/em> is the id of your private network. Make sure to pass a keypair if you want to obtain the password required to login!<\/p>\n Once the system is booted, you can retrieve and decrypt the instance password using nova get-password<\/em>, passing the path to the keypair’s private key:<\/p>\n By the way, all the above steps can be performed in Horizon as well, here’s how a Nano instance console looks like:<\/p>\n Nano Horizon Console<\/p><\/div>\n Nano does not support RDP, since there’s no GUI stack, but it supports WinRM and PowerShell remoting. If you’re not familiar with WinRM, you can think of it as the rough equivalent of SSH for Windows.<\/p>\n In your security groups, you need to allow port 5986 used for WinRM HTTPS connections. Cloudbase-Init took care of configuring the instance’s WinRM HTTPS listener.<\/p>\n To enter a remote PowerShell session:<\/p>\n Done! You’re connected to Nano server!<\/p>\nHow to create a Nano Server image for OpenStack?<\/h3>\n
git clone https:\/\/github.com\/cloudbase\/cloudbase-init-offline-install.git -b nano-server-support\r\ncd cloudbase-init-offline-install<\/pre>\n
$targetPath = \"C:\\VHDs\\Nano\"\r\n$isoPath = \"C:\\ISO\\Windows_Server_2016_Technical_Preview_3.ISO\"\r\n$password = ConvertTo-SecureString -AsPlaintext -Force \"P@ssw0rd\"\r\n<\/pre>\n
.\\NewNanoServerVHD.ps1 -IsoPath $isoPath -TargetPath $targetPath `\r\n-AdministratorPassword $password\r\n<\/pre>\n
$cloudbaseInitZipPath = Join-Path $pwd CloudbaseInitSetup_x64.zip\r\nStart-BitsTransfer -Source \"https:\/\/www.cloudbase.it\/downloads\/CloudbaseInitSetup_x64.zip\" `\r\n-Destination $cloudbaseInitZipPath\r\n<\/pre>\n
$vhdxPath = \"C:\\VHDs\\Nano\\Nano.vhdx\"\r\n.\\CloudbaseInitOfflineSetup.ps1 -VhdPath $vhdxPath -CloudbaseInitZipPath $cloudbaseInitZipPath\r\n<\/pre>\n
glance image-create --property hypervisor_type=hyperv --name \"Nano Server\" ` \r\n--container-format bare --disk-format vhd --file $vhdxPath<\/pre>\n
Booting your first Nano Server OpenStack instance<\/h3>\n
nova boot --flavor m1.standard --image \"Nano Server\" --key-name key1 --nic net-id=$netId nano1\r\n<\/pre>\n
nova get-password nano1 \"\\path\\to\\key1_rsa\"\r\n<\/pre>\n
<\/a>Connecting to Nano Server instances<\/h3>\n
nova secgroup-add-rule default tcp 5986 5986 \"0.0.0.0\/0\"\r\n<\/pre>\n
# Get your instance address, possibly by associating a floating IP: \r\n$ComputerName = \"yourserveraddress\"\r\n\r\n# Your password obtained from \"nova get-password\" is used here \r\n$password = ConvertTo-SecureString -asPlainText -Force \"your_password\"\r\n$c = New-Object System.Management.Automation.PSCredential(\"Admin\", $password)\r\n\r\n$opt = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck\r\n$session = New-PSSession -ComputerName $ComputerName -UseSSL -SessionOption $opt `\r\n-Authentication Basic -Credential $c\r\nEnter-PSSession $session\r\n<\/pre>\n