Azure/AgentBaker

Please help to confirm when $Env:ProgramFiles\containerd\diag.ps1 will exist for collecting containerd hyperv logs

AbelHu opened this issue · 4 comments

Please help to confirm when $Env:ProgramFiles\containerd\diag.ps1 will exist for collecting containerd hyperv logs in the Windows node.

powershell C:\k\debug\collect-windows-logs.ps1

Collecting containerd hyperv logs
Containerd hyperv logs not avalaible

ls $Env:ProgramFiles\containerd\diag.ps1

ls : Cannot find path 'C:\Program Files\containerd\diag.ps1' because it does not exist.
At line:1 char:1
+ ls $Env:ProgramFiles\containerd\diag.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Program Files\containerd\diag.ps1:String) [Get-ChildItem], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

Env:

NAME                                STATUS   ROLES   AGE     VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                         KERNEL-VERSION     CONTAINER-RUNTIME
aks-nodepool1-17963920-vmss000000   Ready    agent   14m     v1.20.2   10.240.0.4    <none>        Ubuntu 18.04.5 LTS               5.4.0-1046-azure   containerd://1.5.0-beta.git31a0f92df+azure
aksnpwin000000                      Ready    agent   8m24s   v1.20.2   10.240.0.35   <none>        Windows Server 2019 Datacenter   10.0.17763.1879    containerd://1.4.4+unknown

@jsturtevant @marosset do you have any insight?

Update: A new containerd package will be released with diag.ps1.

That is a different mechanism for logging for the containerd package that has hyperv support. The daig.ps1 is only required if you will be using ETW to do logging, which isn't necessary since we are using nssm.

The new package being provided does not have Hyper-v capabilities and uses nssm to run the service. The logs should be in the c:\k folder as containerd.log and containerd.err.log.

We should remove below logic in C:\k\debug\collect-windows-logs.ps1

Write-Host "Collecting containerd hyperv logs"
if ((Test-Path "$Env:ProgramFiles\containerd\diag.ps1") -And (Test-Path "$Env:ProgramFiles\containerd\ContainerPlatform.wprp")) {
  $tempHyperv = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName())
  New-Item -Type Directory $tempHyperv
  $persistedLogs = "c:\logs"
  # there will either be an error collecting "bootlogs" or "trace profiles" as only one will be active at time. This will be fixed in future release of the script
  & $Env:ProgramFiles\containerd\diag.ps1 -Snap -ProfilePath "$Env:ProgramFiles\containerd\ContainerPlatform.wprp!ContainerPlatformPersistent" -TraceDirPath "$tempHyperv" -TempPath $persistedLogs
  $hypervlogs = (Get-ChildItem -Path $tempHyperv | Sort-Object LastWriteTime -Descending | Select-Object -First 1).FullName
  $paths += $hypervlogs
}
else {
  Write-Host "Containerd hyperv logs not available"
}