How to label Kubernetes node?

6/8/2018

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?

-- Richard Rublev
kubernetes

1 Answer

6/8/2018

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
node "gke-kubia-defa

ult-pool-98519add-25c1" labeled

-- Richard Rublev
Source: StackOverflow