To check all nodes in a Kubernetes cluster, you can use the `kubectl get nodes` command. Here’s how it works:

### **Command:**
“`bash
kubectl get nodes
“`

### **Output Example:**
“`plaintext
NAME STATUS ROLES AGE VERSION
node1 Ready control-plane 45d v1.28.0
node2 Ready worker 20d v1.28.0
node3 NotReady worker 10d v1.28.0
“`

### **Explanation of Output Columns:**
1. **NAME**: The name of each node in the cluster.
2. **STATUS**: Current status of the node:
– **Ready**: Node is healthy and operational.
– **NotReady**: Node is not functioning properly or unavailable.
– **Unknown**: Node’s state is unreachable.
3. **ROLES**: Node’s role in the cluster, such as `control-plane` or `worker`.
4. **AGE**: Duration since the node was added to the cluster.
5. **VERSION**: Kubernetes version running on the node.

### **Wide View: Additional Details**
To include more details, such as IP addresses and operating system:
“`bash
kubectl get nodes -o wide
“`

**Example Output:**
“`plaintext
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION
node1 Ready control-plane 45d v1.28.0 192.168.1.1 <none> Ubuntu 20.04.6 LTS 5.4.0-122-generic
node2 Ready worker 20d v1.28.0 192.168.1.2 <none> Ubuntu 20.04.6 LTS 5.4.0-122-generic
node3 NotReady worker 10d v1.28.0 192.168.1.3 <none> Ubuntu 20.04.6 LTS 5.4.0-122-generic
“`

### **Tips:**
1. **Detailed Node Information:**
To get detailed information about a specific node:
“`bash
kubectl describe node <node-name>
“`

2. **Filter Nodes by Label:**
To list nodes with a specific label (e.g., all worker nodes):
“`bash
kubectl get nodes –selector=’node-role.kubernetes.io/worker’
“`

3. **Check Node Metrics:**
If the metrics server is installed, you can see CPU and memory usage for each node:
“`bash
kubectl top nodes
“`

This command provides an overview of all nodes in the cluster, helping you monitor their health, roles, and availability.

Sign In

Sign Up