In K8s, every cluster has a set of nodes, some are master and others are worker nodes. How can we know if a node is a master or a worker?
4 Answers
In general, the easiest way to check if node is master or worker is to check if it has label node-role.kubernetes.io/control-plane
(or before Kubernetes v1.20
: node-role.kubernetes.io/master
):
Since Kubernetes v1.20
:
kubectl get nodes -l 'node-role.kubernetes.io/control-plane'
Before Kubernetes v1.20
:
kubectl get nodes -l 'node-role.kubernetes.io/master'
To get workers we can use negation for above expressions (since Kubernetes v1.20
):
kubectl get nodes -l '!node-role.kubernetes.io/control-plane'
Before Kubernetes v1.20
:
kubectl get nodes -l '!node-role.kubernetes.io/master'
Another approach is to use command kubectl cluster-info
which will print IP address of the control-plane
:
Kubernetes control plane is running at https://{ip-address-of-the-control-plane}:8443
Keep in mind that for some cloud provided solutions it may work totally different. For example, in GKE, nodes don't have any roles by default and IP address returned by kubectl cluster-info
is address of the API Server, not listed in kubectl get nodes
command so always remember to double-check docs provided by your Kubernetes cluster provider.

- 2,850
- 1
- 5
- 17
If your cluster is part of an EKS cluster, the master node WILL NOT be available/presented as part of the get nodes
command noted below
kubectl get nodes
This documentation also has more information

- 3,020
- 7
- 18

- 21
- 2
You can use kubectl get nodes
to list all nodes. Given by the roles control-plane
or master
you can identify the node. master
will be replaced with control-plane
in future releases.
By default all other nodes without a role should be the worker nodes.
Also if you need a bit more information about your nodes you can call kubectl get nodes -o wide
.

- 1,928
- 2
- 16
- 26
-
One more thing. Some cloud provider do not show you the master node in a managed environment (i.e. GKE). This depends on provider and setup of the kubernetes cluster. – Manuel Sep 24 '21 at 07:34
The node
which api-server
, kube-controller-management
and kube-scheduler
running on is the master
node.

- 349
- 1
- 6