Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to label Kubernetes node?

Tags:

kubernetes

I am trying to label gpu to my node This does not work

kubectl label node gke-kubia-default-pool-98519add-25c1/10.164.0.3 gpu=true
error: there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. 'kubectl get resource/<resource_name>' instead of 'kubectl get resource resource/<resource_name>'

Neither without node

kubectl label gke-kubia-default-pool-98519add-25c1/10.164.0.2 gpu=true
error: the server doesn't have a resource type "gke-kubia-default-pool-98519add-25c1"

I think that node exists

Name:         kubia-manual-v2
Namespace:    default
Node:         gke-kubia-default-pool-98519add-hsrc/10.164.0.2
Start Time:   Fri, 08 Jun 2018 14:58:04 +0200

How to set the label?

How to list available nodes?

like image 547
Richard Rublev Avatar asked Jun 08 '18 13:06

Richard Rublev


People also ask

How do you describe nodes in Kubernetes?

A Node is a worker machine in Kubernetes and may be either a virtual or a physical machine, depending on the cluster. Each Node is managed by the control plane. A Node can have multiple pods, and the Kubernetes control plane automatically handles scheduling the pods across the Nodes in the cluster.

What is the label of a node?

Node label is a way to group nodes with similar characteristics and applications can specify where to run.


1 Answers

I have solved my problem.First

kubectl get no
NAME                                   STATUS    ROLES     AGE       VERSION
gke-kubia-default-pool-98519add-25c1   Ready     <none>    20h       v1.8.10-gke.0
gke-kubia-default-pool-98519add-5kfr   Ready     <none>    20h       v1.8.10-gke.0
gke-kubia-default-pool-98519add-hsrc   Ready     <none>    20h       v1.8.10-gke.0

Then

kubectl label node gke-kubia-default-pool-98519add-25c1 gpu=true
# output:
node "gke-kubia-default-pool-98519add-25c1" labeled
like image 135
Richard Rublev Avatar answered Nov 11 '22 00:11

Richard Rublev