How to create and set up node via API Server?

81 views Asked by At

I am playing around with the Kubernetes API Server for which I am using the Python client.

In a notebook, I am able to create a node simply by calling:

node = V1Node(
    metadata=dict(name="my-node"),
    status=V1Status(),
    spec=V1NodeSpec()
)

v1.create_node(node)

which will get me a node object which kubectl can describe:

$ kubectl get nodes
NAME        STATUS     ROLES           AGE   VERSION
minikube    Ready      control-plane   19h   v1.26.3
my-node     NotReady   <none>          30m   
$ kubectl describe node my-node
Name:               my-node
Roles:              <none>
Labels:             <none>
Annotations:        node.alpha.kubernetes.io/ttl: 0
CreationTimestamp:  Fri, 28 Jul 2023 09:43:50 +0200
Taints:             node.kubernetes.io/unreachable:NoExecute
                    node.kubernetes.io/unreachable:NoSchedule
Unschedulable:      false
Lease:              Failed to get lease: leases.coordination.k8s.io "my-node" not found
Conditions:
  Type             Status    LastHeartbeatTime                 LastTransitionTime                Reason                   Message
  ----             ------    -----------------                 ------------------                ------                   -------
  Ready            Unknown   Fri, 28 Jul 2023 09:43:50 +0200   Fri, 28 Jul 2023 09:44:52 +0200   NodeStatusNeverUpdated   Kubelet never posted node status.
  MemoryPressure   Unknown   Fri, 28 Jul 2023 09:43:50 +0200   Fri, 28 Jul 2023 09:44:52 +0200   NodeStatusNeverUpdated   Kubelet never posted node status.
  DiskPressure     Unknown   Fri, 28 Jul 2023 09:43:50 +0200   Fri, 28 Jul 2023 09:44:52 +0200   NodeStatusNeverUpdated   Kubelet never posted node status.
  PIDPressure      Unknown   Fri, 28 Jul 2023 09:43:50 +0200   Fri, 28 Jul 2023 09:44:52 +0200   NodeStatusNeverUpdated   Kubelet never posted node status.
Addresses:
System Info:
  Machine ID:                 
  System UUID:                
  Boot ID:                    
  Kernel Version:             
  OS Image:                   
  Operating System:           
  Architecture:               
  Container Runtime Version:  
  Kubelet Version:            
  Kube-Proxy Version:         
PodCIDR:                      10.244.1.0/24
PodCIDRs:                     10.244.1.0/24
Non-terminated Pods:          (0 in total)
  Namespace                   Name    CPU Requests  CPU Limits  Memory Requests  Memory Limits  Age
  ---------                   ----    ------------  ----------  ---------------  -------------  ---
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource           Requests  Limits
  --------           --------  ------
  cpu                0 (0%)    0 (0%)
  memory             0 (0%)    0 (0%)
  ephemeral-storage  0 (0%)    0 (0%)
Events:
  Type    Reason          Age   From             Message
  ----    ------          ----  ----             -------
  Normal  RegisteredNode  25m   node-controller  Node my-node event: Registered Node my-node in Controller

What I struggle with is getting this node ready. Is it possible to install a system on this node using the API? If so, how? I couldn't find an example or anything in the docs to assist here.

0

There are 0 answers