So, in general, if you get a CmdletizationQuery_NotFound
error, may not always be accompanied by info about the failing field if there are many fields in the query...
➜ sig-windows-dev-tools git:(antrea-node-ip-hardcoding) ✗ vagrant winrm winw1 --shell=powershell --command="Get-NetRoute -InterfaceIndex 123 "
No MSFT_NetRoute objects found with property 'InterfaceIndex' equal to '123'. Verify the value of the property and retry.
At line:1 char:1
+ Get-NetRoute -InterfaceIndex 123
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (123:UInt32) [Get-NetRoute], CimJobException
+ FullyQualifiedErrorId : CmdletizationQuery_NotFound_InterfaceIndex,Get-NetRoute
It is because the specific CIMs query failed, and thus the object you were looking for wasnt found.
However, it appears that sometimes a CIMS query will fail to return a result without giving you the specific part of the query which failed (i.e. CmdletizationQuery_NotFound_InterfaceIndex
above was nice and easy to read, but the same query below when we add the DestinationPrefix
search field, gives a more cryptic error message)...
➜ sig-windows-dev-tools git:(antrea-node-ip-hardcoding) ✗ vagrant winrm winw1 --shell=powershell --command="Get-NetRoute -InterfaceIndex 7 -DestinationPrefix 0.0.0.0/1"
No matching MSFT_NetRoute objects found by CIM query for instances of the ROOT/StandardCimv2/MSFT_NetRoute class on the CIM server: SELECT * FROM MSFT_NetRoute WHERE ((DestinationPrefix LIKE '0.0.0.0/1')) AND ((InterfaceIndex = 7)). Verify query parameters and retry.
At line:1 char:1
+ Get-NetRoute -InterfaceIndex 7 -DestinationPrefix 0.0.0.0/1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (MSFT_NetRoute:String) [Get-NetRoute], CimJobException
+ FullyQualifiedErrorId : CmdletizationQuery_NotFound,Get-NetRoute
In this specific case:
- there was no existing IP interface with id = 26 which ALSO had the 0.0.0.0/0 destination prefix
In more general cases, if you get a similar error, it could be caused by the fact that your just crafting a CIMS query that is not able to return any data.
Now, since the original question was related to a Kubernetes CNI provider, I'll address that part:
In Kubernetes on Windows
CNI providers such as antrea need this information when coming online, and the general thing to make sure of is the fact that your windows kubelet is setting its IP address correctly (i.e. via the node-ip field on startup).
In my case, I found that after setting this, this query was generated correctly, and it started looking at the right interface for this value (i.e. the one that corresponded to my Node's internal IP address).
There is the broader question of how, in general, DestinationPrefixes should be setup in Kubernetes windows VMs, but that is outside the scope of my original question, but in general, if you have setup your network correctly such that:
- your
node-ip
as shown by kubectl get nodes -o wide
is the correct one that you want for your windows kubelet and
- that
node-ip
is associated w/ an interface which has a destination prefix IP address = 0.0.0.0/0
Then specifically the antrea CNI provider will be able to accurately determine the correct nextHop
for its gateway, which ultimately is used to configure the OVS routing rules on a node for your pod networks.