Closed oingooing closed 1 month ago
I found the cause.
I opened the /calico/install.ps1 script in the sigwindowstools/calico-install:v3.25.1-hostprocess image, the install.ps1 script was incorrect. Without deleting the $env:CNI_CONF_DIR directory $env:CNI_BIN_DIR Directory removal syntax is redundant. Maybe the wrong script was built a while back.
[wrong]
Write-Host "Starting install. Cleaning up any previous files"
Remove-Item -Path $env:CNI_BIN_DIR/* -Recurse
Remove-Item -Path $env:CNI_BIN_DIR/* -Recurse
[expect]
Write-Host "Starting install. Cleaning up any previous files"
Remove-Item -Path $env:CNI_BIN_DIR/* -Recurse
Remove-Item -Path $env:CNI_CONF_DIR/* -Recurse
I will build the image myself and use it.
Describe the bug When calico pod restarted, Sometimes the node status changes to "NotReady" because "calico-install.ps1" execution fail
To Reproduce
"Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized"
2024-07-09T16:52:38.1806101+09:00 stderr F Set-Content : Stream was not readable. 2024-07-09T16:52:38.1806101+09:00 stderr F + ... :CNI_MTU) | Set-Content "${env:CNI_CONF_DIR}/10-calico.conflist" -For ... 2024-07-09T16:52:38.1806101+09:00 stderr F + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2024-07-09T16:52:38.183765+09:00 stderr F + CategoryInfo : InvalidArgument: (C:\etc\cni\net.d\10-calico.conflist:String) [Set-Content], ArgumentExc 2024-07-09T16:52:38.1826068+09:00 stdout F CNI configured 2024-07-09T16:52:38.183765+09:00 stderr F eption 2024-07-09T16:52:38.183765+09:00 stderr F + FullyQualifiedErrorId : GetContentWriterArgumentError,Microsoft.PowerShell.Commands.SetContentCommand 2024-07-09T16:52:38.183765+09:00 stderr F
Expected behavior When calico is restarted, initialization should be completed normally.
Kubernetes (please complete the following information):
Additional context Should we put a short Start-Sleep before Set-Content? A file lock that has not cleared is my first guess at the cause.