Skip to main content

Setup Kubernetes Cluster using Minikube

We will use minikube in to run kubernetes cluster in your local machine. You can download and install minikube from their official website: https://minikube.sigs.k8s.io/docs/.

Start and Configure a Kubernetes Cluster

Start Minkube

minikube start --kubernetes-version=v1.31.0 --cpus=2 --memory=4096
  • This starts a cluster with 2 CPUs and 4GB of memory, running Kubernetes version 1.31.0.
  • You can check the cluster status: kubectl cluster-info
  • Which should return below information:
Kubernetes control plane is running at https://127.0.0.1:57821
CoreDNS is running at https://127.0.0.1:57821/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

View Cluster Configuration

Check Node information.

kubectl get nodes
kubectl describe node minikube

List system components of kubernetes such as API Server, Scheduler, Controller Manager, CoreDNS, etc.

kubectl get pods -n kube-system

Above command should return you list like below.

NAME                               READY   STATUS    RESTARTS      AGE
coredns-6f6b679f8f-88xz9 1/1 Running 0 24m
etcd-minikube 1/1 Running 0 24m
kube-apiserver-minikube 1/1 Running 0 24m
kube-controller-manager-minikube 1/1 Running 0 24m
kube-proxy-zxlvw 1/1 Running 0 24m
kube-scheduler-minikube 1/1 Running 0 24m
storage-provisioner 1/1 Running 1 (24m ago) 24m

Add/Remove Nodes

Although Minikube is single-node by default, simulate multi-node behavior using Minikube profiles. Here's how to add a new Node in minikube.

minikube node add

Get list of nodes again using kubectl get nodes and it should return newly added nodes.

NAME           STATUS   ROLES           AGE   VERSION
minikube Ready control-plane 32m v1.31.0
minikube-m02 Ready <none> 17s v1.31.0

Removing a Node.

minikube node delete minikube-m02

References