The command to check all nodes in a Kubernetes cluster is:
“`bash
kubectl get nodes
“`
### **Output Example**:
“`plaintext
NAME STATUS ROLES AGE VERSION
node-1.cluster.local Ready worker 5d v1.27.3
node-2.cluster.local Ready worker 5d v1.27.3
master-node.cluster.local Ready master 5d v1.27.3
“`
### **Explanation of Output**:
– **NAME**: The hostname or name of the node in the cluster.
– **STATUS**: Indicates if the node is operational:
– `Ready`: The node is healthy and ready to schedule workloads.
– `NotReady`: The node is not in a healthy state.
– **ROLES**: The node’s role (e.g., `master`, `worker`, etc.).
– **AGE**: How long the node has been part of the cluster.
– **VERSION**: The version of Kubernetes running on the node.
### **Additional Commands**:
1. **Detailed Node Information**:
“`bash
kubectl describe node [NODE_NAME]
“`
This provides detailed information about a specific node, including resource usage and conditions.
2. **Node Resource Metrics** (if metrics server is installed):
“`bash
kubectl top nodes
“`
This shows CPU and memory usage for all nodes.
3. **Node Labels**:
“`bash
kubectl get nodes –show-labels
“`
Lists all nodes along with their labels, which are useful for workload scheduling and filtering.
These commands provide a comprehensive view of the nodes in your Kubernetes cluster.
