kubernetes-sigs / sig-windows-tools

Repository for tools and artifacts related to the sig-windows charter in Kubernetes. Scripts to assist kubeadm and wincat and flannel will be hosted here.
Apache License 2.0
123 stars 123 forks source link

Calico sometimes get the error "Set-Content: Stream was not readable" when calico-install.ps1 script runs #372

Closed oingooing closed 1 month ago

oingooing commented 1 month ago

Describe the bug When calico pod restarted, Sometimes the node status changes to "NotReady" because "calico-install.ps1" execution fail

To Reproduce

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.

oingooing commented 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.