This guide provides a beginner-friendly introduction to Kubernetes nodes and how to manage them using a local Minikube cluster. You will learn how to start, stop, and inspect the node that powers your local Kubernetes environment, as well as understand key concepts like labels and taints.
- Project Goals
- Prerequisites
- Core Concepts
- Managing the Minikube Cluster and Node
- Understanding Node Details
- Working with Node Labels
- Node Scaling and Upgrades in Minikube
- Cluster Cleanup
- Troubleshooting
- Evidence for Submission
By the end of this project, you will be able to:
- Understand the role of a node in a Kubernetes cluster.
- Use
kubectlto inspect node details, including labels, capacity, and taints. - Add custom labels to a node for better organization.
- Confidently perform basic lifecycle operations on your Minikube cluster.
- Minikube Installed: You must have a working Minikube installation.
- Docker Running: The Docker service must be active on your machine.
In Kubernetes, a node is a worker machine where your containers are deployed. It can be a virtual or physical machine. Each node is managed by the control plane and contains the services necessary to run Pods, which are the smallest deployable units in Kubernetes. In our Minikube setup, the entire cluster runs on a single node.
If your cluster isn't running, open your terminal and start it:
minikube startUse kubectl to view the nodes in your cluster. You will see a single node for your Minikube setup.
kubectl get nodesThis command lists all nodes, their status (e.g., Ready), roles, age, and Kubernetes version.
To get a comprehensive overview of your node, use the describe command. This is crucial for understanding the node's properties.
kubectl describe node minikube(Replace minikube if your node has a different name).
This command provides detailed information, which we will explore in the next section.
The describe node command output contains valuable information. Let's break down a few key parts.
Labels are key/value pairs that are attached to Kubernetes objects, such as nodes. They are used to organize and to select subsets of objects. For example, a node could be labeled with disktype=ssd or environment=production. The Kubernetes scheduler can use these labels to decide where to place pods.
In the describe node output, look for the Labels section. You will see several default labels.
This section shows the total resources available on the node (Capacity) and the resources available for pods to consume (Allocatable). The difference between capacity and allocatable is reserved for the operating system and Kubernetes system daemons.
- Capacity: The total amount of CPU, memory, and storage on the node.
- Allocatable: The amount of resources that are available for pods.
Understanding this is key to managing application performance and resource quotas.
- A Taint is applied to a node to repel a set of pods.
- A Toleration is applied to a pod to allow it to be scheduled on a node with a matching taint.
This mechanism ensures that pods are not scheduled onto inappropriate nodes. For example, a node with a dedicated GPU might be tainted to only allow pods that require a GPU. In the describe node output, you can see if any Taints are applied.
Labels are a fundamental part of Kubernetes. Let's practice by adding one.
You can add your own labels to a node to categorize it. Let's add a label to identify this node as being for development purposes.
kubectl label nodes minikube environment=developmentTo verify that the label was added, you can view the labels for the node:
kubectl get nodes --show-labelsYou should see your new environment=development label in the list.
By default, Minikube creates a single-node cluster. This is intentional, as Minikube is designed for local development and testing, not for production workloads. This single-node setup means you cannot scale your cluster by adding more nodes as you would in a production environment (e.g., with kubeadm or a cloud provider). The primary goal is to have a lightweight, portable Kubernetes environment that runs on your local machine.
While you can't add more nodes to a single Minikube cluster, you can simulate a multi-node environment by creating multiple Minikube clusters (profiles), as described in the "Managing Multiple Clusters with Profiles" section.
Minikube makes it easy to test different versions of Kubernetes. You can create a new cluster with a specific Kubernetes version or upgrade your existing cluster.
To start a cluster with a specific Kubernetes version:
minikube start --kubernetes-version=v1.25.3You can find available Kubernetes versions on the official Kubernetes release page.
To upgrade the Kubernetes version of an existing Minikube cluster:
You can use the minikube start command again with a newer --kubernetes-version. Minikube will handle the upgrade process. For example, if your cluster is running v1.25.3 and you want to upgrade to v1.26.0, you would run:
minikube start --kubernetes-version=v1.26.0This approach allows you to keep your development environment in sync with your production environment's Kubernetes version.
After you are done, you can stop or delete your cluster.
- Stopping the cluster preserves its state:
minikube stop
- Deleting the cluster removes it completely:
minikube delete
Yes, you can run more than one Minikube cluster on the same machine. Minikube uses profiles to manage different clusters. By default, you use a profile named minikube, but you can create and manage others.
To create a new cluster, use the -p (or --profile) flag with the start command.
# Create a new cluster named 'test-cluster'
minikube start -p test-clusterThis will create a completely separate cluster. Your kubectl context will automatically be switched to this new cluster.
To run any command against a specific cluster, use the -p flag.
# Stop the new cluster
minikube stop -p test-cluster
# Delete the new cluster
minikube delete -p test-clusterYou can list all your profiles and switch your kubectl context between them.
# List all profiles
minikube profile list
# Switch your kubectl context to the default minikube cluster
minikube profile minikubeThis feature is incredibly useful for testing different Kubernetes versions or configurations simultaneously.
-
kubectlcommand not found:- Solution: Ensure
kubectlis installed and in your system's PATH, or useminikube kubectl -- <command>.
- Solution: Ensure
-
Node is not in
Readystate:- Solution: Run
minikube statusandminikube logsto diagnose the issue. The problem is often related to resource constraints or Docker issues.
- Solution: Run
-
Error connecting to the server:
- Solution: Your cluster may not be running. Use
minikube startto activate it.
- Solution: Your cluster may not be running. Use
- Figure 1: Output of
minikube start - Figure 2: Output of
kubectl get nodes - Figure 3: Output of
kubectl describe node - Figure 4: Output of
kubectl get nodes --show-labels



