Skip to content

Commit 2d1268e

Browse files
author
Jaromir Kaspar
authored
Merge pull request #403 from microsoft/dev
Dev
2 parents 2f9b152 + d9c6e1f commit 2d1268e

File tree

3 files changed

+81
-19
lines changed

3 files changed

+81
-19
lines changed

Scenarios/AzSHCI and Kubernetes/Scenario.ps1

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
#############################
2+
### Run from Hyper-V Host ###
3+
#############################
4+
5+
#run from Host to expand C: drives in VMs to 120GB. This is required as Install-AKSHCI checks free space on C (should check free space in CSV)
6+
$VMs=Get-VM -VMName WSLab*azshci*
7+
$VMs | Get-VMHardDiskDrive -ControllerLocation 0 | Resize-VHD -SizeBytes 120GB
8+
#VM Credentials
9+
$secpasswd = ConvertTo-SecureString "LS1setup!" -AsPlainText -Force
10+
$VMCreds = New-Object System.Management.Automation.PSCredential ("corp\LabAdmin", $secpasswd)
11+
Foreach ($VM in $VMs){
12+
Invoke-Command -VMname $vm.name -Credential $VMCreds -ScriptBlock {
13+
$part=Get-Partition -DriveLetter c
14+
$sizemax=($part |Get-PartitionSupportedSize).SizeMax
15+
$part | Resize-Partition -Size $sizemax
16+
}
17+
}
18+
19+
###################
20+
### Run from DC ###
21+
###################
22+
123
#region Create 2 node cluster (just simple. Not for prod - follow hyperconverged scenario for real clusters https://github.com/microsoft/WSLab/tree/master/Scenarios/S2D%20Hyperconverged)
224
# LabConfig
325
$Servers="AzsHCI1","AzSHCI2"
@@ -6,8 +28,7 @@ $ClusterName="AzSHCI-Cluster"
628
# Install features for management on server
729
Install-WindowsFeature -Name RSAT-Clustering,RSAT-Clustering-Mgmt,RSAT-Clustering-PowerShell,RSAT-Hyper-V-Tools
830

9-
# Update servers - if you will update, script will fail in install-akshci as it checks for free space. After updates will be free space less than 50GB
10-
<#
31+
# Update servers
1132
Invoke-Command -ComputerName $servers -ScriptBlock {
1233
#Grab updates
1334
$ScanResult=Invoke-CimMethod -Namespace "root/Microsoft/Windows/WindowsUpdate" -ClassName "MSFT_WUOperations" -MethodName ScanForUpdates -Arguments @{SearchCriteria="IsInstalled=0"}
@@ -24,7 +45,6 @@ if ($ServersToReboot){
2445
#failsafe - sometimes it evaluates, that servers completed restart after first restart (hyper-v needs 2)
2546
Start-sleep 20
2647
}
27-
#>
2848

2949
# Install features on servers
3050
Invoke-Command -computername $Servers -ScriptBlock {
@@ -64,10 +84,10 @@ Enable-ClusterS2D -CimSession $ClusterName -Verbose -Confirm:0
6484

6585
#region Download AKS HCI module
6686
$ProgressPreference='SilentlyContinue' #for faster download
67-
Invoke-WebRequest -Uri "https://aka.ms/aks-hci-download" -UseBasicParsing -OutFile "$env:USERPROFILE\Downloads\AKS-HCI-Public-Preview-1.0.zip"
87+
Invoke-WebRequest -Uri "https://aka.ms/aks-hci-download" -UseBasicParsing -OutFile "$env:USERPROFILE\Downloads\AKS-HCI-Public-Preview-Oct-2020.zip"
6888
$ProgressPreference='Continue' #return progress preference back
6989
#unzip
70-
Expand-Archive -Path "$env:USERPROFILE\Downloads\AKS-HCI-Public-Preview-1.0.zip" -DestinationPath "$env:USERPROFILE\Downloads" -Force
90+
Expand-Archive -Path "$env:USERPROFILE\Downloads\AKS-HCI-Public-Preview-Oct-2020.zip" -DestinationPath "$env:USERPROFILE\Downloads" -Force
7191
Expand-Archive -Path "$env:USERPROFILE\Downloads\AksHci.Powershell.zip" -DestinationPath "$env:USERPROFILE\Downloads\AksHci.Powershell" -Force
7292

7393
#endregion
@@ -201,13 +221,16 @@ if (($subscriptions).count -gt 1){
201221
$subscriptionID=(Get-AzSubscription).ID
202222

203223
#register Azure Stack HCI
204-
#first disable IE ESC
205-
$AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
206-
Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0
207-
#register (needs to run 3 times and allow all web pages in IE)...
208-
1..3 | foreach-object {
209-
Register-AzStackHCI -SubscriptionID $subscriptionID -ComputerName $ClusterName
210-
}
224+
#add some trusted sites (to be able to authenticate with Register-AzStackHCI)
225+
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\live.com\login" /v https /t REG_DWORD /d 2
226+
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\microsoftonline.com\login" /v https /t REG_DWORD /d 2
227+
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\msauth.net\aadcdn" /v https /t REG_DWORD /d 2
228+
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\msauth.net\logincdn" /v https /t REG_DWORD /d 2
229+
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\msftauth.net\aadcdn" /v https /t REG_DWORD /d 2
230+
#and register
231+
Register-AzStackHCI -SubscriptionID $subscriptionID -ComputerName $ClusterName
232+
233+
211234
#or more complex
212235
<#
213236
#grab location
@@ -285,6 +308,10 @@ Get-AzADApplication -DisplayNameStartWith $ClusterName | Remove-AzADApplication
285308
# following code is work-in-progress #
286309
######################################
287310

311+
######################
312+
### Run from Win10 ###
313+
######################
314+
288315
#region Windows Admin Center on Win10
289316

290317
#install WAC
@@ -310,25 +337,36 @@ Get-AzADApplication -DisplayNameStartWith $ClusterName | Remove-AzADApplication
310337

311338

312339
#add feed
340+
#download nupgk (included in aks-hci module)
341+
$ProgressPreference='SilentlyContinue' #for faster download
342+
Invoke-WebRequest -Uri "https://aka.ms/aks-hci-download" -UseBasicParsing -OutFile "$env:USERPROFILE\Downloads\AKS-HCI-Public-Preview-Oct-2020.zip"
343+
$ProgressPreference='Continue' #return progress preference back
344+
#unzip
345+
Expand-Archive -Path "$env:USERPROFILE\Downloads\AKS-HCI-Public-Preview-Oct-2020.zip" -DestinationPath "$env:USERPROFILE\Downloads" -Force
346+
Expand-Archive -Path "$env:USERPROFILE\Downloads\AksHci.Powershell.zip" -DestinationPath "$env:USERPROFILE\Downloads\AksHci.Powershell" -Force
313347
$Filename=Get-ChildItem -Path $env:userprofile\downloads\ | Where-Object Name -like "msft.sme.aks.*.nupkg"
314348
New-Item -Path "C:\WACFeeds\" -Name Feeds -ItemType Directory -Force
315349
Copy-Item -Path $FileName.FullName -Destination "C:\WACFeeds\"
316350
Add-Feed -GatewayEndpoint "https://localhost:6516/" -Feed "C:\WACFeeds\"
317351

318-
# List Kubernetes extensions
352+
# List Kubernetes extensions (you need to log into WAC in Edge for this command to succeed)
319353
Get-Extension "https://localhost:6516/" | where title -like *kubernetes*
320354

321-
# Install Kubernetes Extension (still does not seems to be installed from GUI, bug?)
355+
# Install Kubernetes Extension
322356
$extension=Get-Extension "https://localhost:6516/" | where title -like *kubernetes*
323357
Install-Extension -ExtensionId $extension.id
324358

325359
#endregion
326360

361+
###################
362+
### Run from DC ###
363+
###################
364+
327365
#region Windows Admin Center on GW
328366

329367
#Install Edge
330368
$ProgressPreference='SilentlyContinue' #for faster download
331-
Invoke-WebRequest -Uri "http://dl.delivery.mp.microsoft.com/filestreamingservice/files/40e309b4-5d46-4AE8-b839-bd74b4cff36e/MicrosoftEdgeEnterpriseX64.msi" -UseBasicParsing -OutFile "$env:USERPROFILE\Downloads\MicrosoftEdgeEnterpriseX64.msi"
369+
Invoke-WebRequest -Uri "https://aka.ms/edge-msi" -UseBasicParsing -OutFile "$env:USERPROFILE\Downloads\MicrosoftEdgeEnterpriseX64.msi"
332370
$ProgressPreference='Continue' #return progress preference back
333371
#start install
334372
Start-Process -Wait -Filepath msiexec.exe -Argumentlist "/i $env:UserProfile\Downloads\MicrosoftEdgeEnterpriseX64.msi /q"
@@ -376,10 +414,10 @@ foreach ($computer in $computers){
376414

377415
#Download AKS HCI module
378416
$ProgressPreference='SilentlyContinue' #for faster download
379-
Invoke-WebRequest -Uri "https://aka.ms/aks-hci-download" -UseBasicParsing -OutFile "$env:USERPROFILE\Downloads\AKS-HCI-Public-Preview-1.0.zip"
417+
Invoke-WebRequest -Uri "https://aka.ms/aks-hci-download" -UseBasicParsing -OutFile "$env:USERPROFILE\Downloads\AKS-HCI-Public-Preview-Oct-2020.zip"
380418
$ProgressPreference='Continue' #return progress preference back
381419
#unzip
382-
Expand-Archive -Path "$env:USERPROFILE\Downloads\AKS-HCI-Public-Preview-1.0.zip" -DestinationPath "$env:USERPROFILE\Downloads" -Force
420+
Expand-Archive -Path "$env:USERPROFILE\Downloads\AKS-HCI-Public-Preview-Oct-2020.zip" -DestinationPath "$env:USERPROFILE\Downloads" -Force
383421
Expand-Archive -Path "$env:USERPROFILE\Downloads\AksHci.Powershell.zip" -DestinationPath "$env:USERPROFILE\Downloads" -Force
384422

385423
#copy nupkg to WAC

Scenarios/AzSHCI and Kubernetes/readme.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ Run all code from DC. Follow [Scenario.ps1](/Scenarios/AzSHCI%20and%20Kubernetes
4040

4141
![](/Scenarios/AzSHCI%20and%20Kubernetes/Screenshots/PowerShell_ISE01.png)
4242

43+
Note: (optional) there is known issue, that when installing AKS, scripts checks for available space on C: drive (instead of cluster storage). Since it needs 50GB free space, it might not be enough if you run Windows Update on servers. If you want to expand disks, run following code
44+
45+
```PowerSHell
46+
#run from Host to expand C: drives in VMs to 120GB
47+
$VMs=Get-VM -VMName WSLab*azshci*
48+
$VMs | Get-VMHardDiskDrive -ControllerLocation 0 | Resize-VHD -SizeBytes 120GB
49+
#VM Credentials
50+
$secpasswd = ConvertTo-SecureString "LS1setup!" -AsPlainText -Force
51+
$VMCreds = New-Object System.Management.Automation.PSCredential ("corp\LabAdmin", $secpasswd)
52+
Foreach ($VM in $VMs){
53+
Invoke-Command -VMname $vm.name -Credential $VMCreds -ScriptBlock {
54+
$part=Get-Partition -DriveLetter c
55+
$sizemax=($part |Get-PartitionSupportedSize).SizeMax
56+
$part | Resize-Partition -Size $sizemax
57+
}
58+
}
59+
60+
```
61+
4362
### Region Create 2 node cluster
4463

4564
This region will deploy minimum configuration possible to have 2 node cluster. It does not configure any sofisticated networking or spectre/meltdown mitigation etc. For real clusters follow [S2D HyperConverged Scenario](https://github.com/microsoft/WSLab/tree/master/Scenarios/S2D%20Hyperconverged)

Scripts/3_Deploy.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,13 @@ If (-not $isAdmin) {
518518
#configure number of processors
519519
if ($VMConfig.VMProcessorCount){
520520
if ($VMConfig.VMProcessorCount -eq "Max"){
521-
WriteInfo "`t Configuring VM Processor Count to Max ($NumberOfLogicalProcessors)"
522-
$VMTemp | Set-VMProcessor -Count $NumberOfLogicalProcessors
521+
if ($NumberOfLogicalProcessors -gt 64){
522+
WriteInfo "`t Processors Count $NumberOfLogicalProcessors and Max is specified. Configuring VM Processor Count to 64"
523+
$VMTemp | Set-VMProcessor -Count 64
524+
}else{
525+
WriteInfo "`t Configuring VM Processor Count to Max ($NumberOfLogicalProcessors)"
526+
$VMTemp | Set-VMProcessor -Count $NumberOfLogicalProcessors
527+
}
523528
}elseif ($VMConfig.VMProcessorCount -le $NumberOfLogicalProcessors){
524529
WriteInfo "`t Configuring VM Processor Count to $($VMConfig.VMProcessorCount)"
525530
$VMTemp | Set-VMProcessor -Count $VMConfig.VMProcessorCount

0 commit comments

Comments
 (0)