calico icon indicating copy to clipboard operation
calico copied to clipboard

Error running PrepareNode.ps1

Open danielescattaglia opened this issue 3 years ago • 2 comments

Hello Running script using ContainerD as CRI, fails with the error below (c:\PrepareNode.ps1 -KubernetesVersion v1.25.2 -ContainerRuntime ContainerD). Where to find missing functions? Thanks

Daniele

C:\PrepareNode.ps1 : The term 'Get-HNSNetwork' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ c:\PrepareNode.ps1 -KubernetesVersion v1.25.2 -ContainerRuntime Conta ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-HNSNetwork:String) [PrepareNode.ps1], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,PrepareNode.ps1
  • Calico version 3.24
  • Orchestrator version: kubernetes 1.25.2
  • Windows Server Standard 2022/2019

danielescattaglia avatar Oct 13 '22 13:10 danielescattaglia

Hi @danielescattaglia, could you share some more details on your setup? Are you running on AWS and using "Powershell for AWS" by any chance? (long shot I know, but this is what I could find by googling around)

coutinhop avatar Oct 18 '22 16:10 coutinhop

Hello. No, I'm running on vSphere's VM in my server farm. No cloud providers involved. Windows image has been downloaded from Microsoft. Thanks

Daniele

danielescattaglia avatar Oct 18 '22 17:10 danielescattaglia

@coutinhop do we need more information?

mazdakn avatar Feb 06 '23 19:02 mazdakn

The Get-HNSNetwork function comes from hns.psm1, imported here: https://github.com/projectcalico/calico/blob/release-v3.24/calico/scripts/PrepareNode.ps1#L81 and downloaded from https://raw.githubusercontent.com/Microsoft/SDN/master/Kubernetes/windows/hns.psm1. By any chance do you see any errors regarding that?

Though, on a side note, these scripts (PrepareNode.ps1 and Install-Containerd.ps1 are now maintained by sig-windows and I don't see that command in the current version: https://github.com/kubernetes-sigs/sig-windows-tools/blob/master/hostprocess/PrepareNode.ps1

Could you try the updated scripts?

coutinhop avatar Sep 19 '23 16:09 coutinhop