Is there any shortcut or kubectl command or REST API call to get a list of worker nodes only. ( not including the master nodes )
Update: For the masters we can do like this:
kubectl get nodes --selector=node-role.kubernetes.io/master
for the workers I dont see any such label created by default. Can we do get by reversing or do != kind of thing on selector.
We can't grep it either:
C02W84XMHTD5:ucp iahmad$ kubectl get nodes | grep worker
C02W84XMHTD5:ucp iahmad$
C02W84XMHTD5:ucp iahmad$ kubectl get nodes -o wide| grep worker
C02W84XMHTD5:ucp iahmad$
C02W84XMHTD5:ucp iahmad$ kubectl get nodes -o yaml | grep worker
C02W84XMHTD5:ucp iahmad$
C02W84XMHTD5:ucp iahmad$ kubectl get nodes -o json | grep worker
C02W84XMHTD5:ucp iahmad$
My use case is that want to get this list every minute to update the external load balancer pools, in case new nodes are added, removed from the cluster. Indeed I can label them myself but if there is some default built in way of doing this would be useful