Getting the Kubernetes nodes information.
var client = MinikubeTests.CreateClient();
var node = client.CoreV1.ListNode().Items.First();
var nodeName = node.Metadata.Name;
Getting the node conditions as:
foreach(var nodeStatus in node.Status.Conditions) {
Console.WriteLine("{0} - {1}", nodeStatus.Type, nodeStatus.Status);
}
Here the node ready status is true. How can we get the status while the node is being created?
Ok I see what your getting at . Use
NodeCondition
. It provides information about various conditions or states of anode
, such as whether it is ready or not .NodeCondition
may not immediately indicate the readiness status as True because it takes some time for the node to become fully operational.Firstly check if the
creating
condition is present and supported by your cluster at all . presence of aCreating
condition in the node status may depend on the version and configuration of yourKubernetes cluster
. This condition is not a standard condition type and may not be present in all clusters. If yourcluster
does not include this condition, you can use theReady
condition to determine if the node is ready or not and to that extent you will loose granularity .check if the
Creating
condition is present in the node status by retrieving the node information and checking theConditions
property of the node’s status.If this condition is present, it means that the node has a
Creating
condition. Otherwise, it means that the node does not have this condition. That's regardless of whether the node is ready or not. It does this by retrieving the node information and checking theConditions property
of the node’s status to see if it includes a condition with Type set to"Creating"
.If the
creating
condition is present then run the below code to catch if the node is in that condition Again This condition may not be present in allKubernetes clusters,
as it is not a standard condition type. If your cluster does not include this condition, you can use theReady
condition to determine if the node is ready or not.