DEV Community

Mark Dsouza
Mark Dsouza

Posted on

From Laptop to Cloud: Setting Up Kubernetes Clusters the Right Way

Building Kubernetes Clusters: From Local to Production

Kubernetes is everywhere — powering modern applications, scaling startups, and running critical infrastructure across the globe. But here's the problem: most developers use Kubernetes without ever truly understanding how a cluster is built.

If you've ever run a few kubectl commands, deployed a YAML file, or followed a quick tutorial, you've only scratched the surface.

In this guide, we're going deeper. Instead of just using Kubernetes, we'll build and explore clusters across different environments, starting from your local machine and gradually moving toward production-grade setups. Along the way, you'll not only learn how to set things up, but more importantly, why each approach exists.

What We'll Cover

  • Kind — the fastest way to spin up a lightweight Kubernetes cluster using Docker
  • Minikube — a more feature-rich local environment for development and testing
  • Kubeadm — the real way to bootstrap your own Kubernetes cluster from scratch
  • Amazon EKS — a production-ready, managed Kubernetes service used in industry

By the end of this article, you'll understand:

  • How Kubernetes clusters actually work under the hood
  • The differences between local, self-managed, and managed clusters
  • Which setup is right for your use case

Kubernetes Architecture


Before we start installing anything, let's quickly understand what a Kubernetes cluster actually looks like.

A Kubernetes cluster has two main parts:

1. Control Plane (the brain 🧠)

This is the part that makes decisions. It decides what should run, where it should run, and when to restart something if it fails.

Component Role
API Server Entry point — everything talks to this
Scheduler Decides which node runs your app
Controller Manager Keeps things in the desired state
etcd Stores all cluster data

2. Worker Nodes (the machines ⚙️)

This is where your actual applications run.

Component Role
kubelet Talks to the control plane
kube-proxy Handles networking
Pods Smallest unit where your containers run

Simple Mental Model

Think of Kubernetes like a company:

  • Control Plane = Manager (assigns work, checks everything)
  • Worker Nodes = Employees (do the actual work)

Cluster Setup Options

Tool Best For
Kind Lightweight multi-node clusters inside Docker
Minikube Simple single-node local setup
Kubeadm Real multi-node clusters from scratch
EKS / AKS / GKE Enterprise-level managed clusters

1. Kind

Kind (Kubernetes in Docker) lets you create a Kubernetes cluster using Docker containers instead of real machines. It's the fastest and easiest way to spin up a local cluster for learning, testing, and development.

Step 1: Install Docker

Make sure Docker is installed on your system: Docker Installation Guide

Step 2: Install Kind

Run the appropriate install script for your OS:

Linux (install.sh)

#!/bin/bash

set -e
set -o pipefail

echo "Starting installation of Docker, Kind, and kubectl..."

# Install Docker
if ! command -v docker &>/dev/null; then
  echo "Installing Docker..."
  sudo apt-get update -y
  sudo apt-get install -y docker.io
  sudo usermod -aG docker "$USER"
  echo "Docker installed and user added to docker group."
else
  echo "Docker is already installed."
fi

# Install Kind
if ! command -v kind &>/dev/null; then
  echo "Installing Kind..."
  ARCH=$(uname -m)
  if [ "$ARCH" = "x86_64" ]; then
    curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.29.0/kind-linux-amd64
  elif [ "$ARCH" = "aarch64" ]; then
    curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.29.0/kind-linux-arm64
  else
    echo "Unsupported architecture: $ARCH"
    exit 1
  fi
  chmod +x ./kind
  sudo mv ./kind /usr/local/bin/kind
  echo "Kind installed successfully."
else
  echo "Kind is already installed."
fi

# Install kubectl
if ! command -v kubectl &>/dev/null; then
  echo "Installing kubectl (latest stable version)..."
  curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
  sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
  rm -f kubectl
  echo "kubectl installed successfully."
else
  echo "kubectl is already installed."
fi

echo "Installed Versions:"
docker --version
kind --version
kubectl version --client --output=yaml
Enter fullscreen mode Exit fullscreen mode

macOS (install.sh)

#!/bin/bash

set -e
set -o pipefail

echo "Starting installation of Docker, Kind, and kubectl on macOS (M1/M2)..."

# Install Homebrew
if ! command -v brew &>/dev/null; then
  echo "Installing Homebrew..."
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
  eval "$(/opt/homebrew/bin/brew shellenv)"
else
  echo "Homebrew is already installed."
fi

# Install Docker
if ! command -v docker &>/dev/null; then
  echo "Installing Docker Desktop..."
  brew install --cask docker
  echo "Please launch Docker Desktop manually after installation."
else
  echo "Docker is already installed."
fi

# Install Kind
if ! command -v kind &>/dev/null; then
  brew install kind
  echo "Kind installed successfully."
else
  echo "Kind is already installed."
fi

# Install kubectl
if ! command -v kubectl &>/dev/null; then
  brew install kubectl
  echo "kubectl installed successfully."
else
  echo "kubectl is already installed."
fi

echo "Installed Versions:"
docker --version || echo "Docker not running yet (open Docker Desktop)."
kind --version
kubectl version --client --output=yaml
Enter fullscreen mode Exit fullscreen mode

Step 3: Create a Kind Cluster

Create a configuration file named kind-cluster.yml:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
    image: kindest/node:v1.33.1
  - role: worker
    image: kindest/node:v1.33.1
  - role: worker
    image: kindest/node:v1.33.1
  - role: worker
    image: kindest/node:v1.33.1
Enter fullscreen mode Exit fullscreen mode

Then create the cluster:

kind create cluster --config kind-cluster.yml --name mark-cluster
Enter fullscreen mode Exit fullscreen mode

Step 4: Verify the Cluster

# Check running nodes
kubectl get nodes

# View cluster info
kubectl cluster-info
Enter fullscreen mode Exit fullscreen mode

Learning Resource: For a quick setup with hands-on examples, check out themark007/Kubernetes-learning on GitHub.


2. Minikube

Kind vs. Minikube

Kind Minikube
Node setup Multi-node Single-node
Best for Quick multi-node simulation Beginner-friendly local dev

Step 1: Install Minikube

macOS

brew install minikube
Enter fullscreen mode Exit fullscreen mode

Linux

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
Enter fullscreen mode Exit fullscreen mode

Step 2: Start the Cluster

minikube start
Enter fullscreen mode Exit fullscreen mode

This will create a single-node Kubernetes cluster and configure kubectl automatically.

Step 3: Verify the Cluster

kubectl get nodes
Enter fullscreen mode Exit fullscreen mode

You should see one node in Ready state.

Step 4: Access Your App (Optional)

minikube service <service-name>
Enter fullscreen mode Exit fullscreen mode

This opens your service in the browser.


What's Next?

Kind and Minikube make Kubernetes easy to get started with locally. But to truly understand Kubernetes end-to-end:

  • Kubeadm shows you how a real cluster is bootstrapped from scratch
  • Amazon EKS shows how Kubernetes runs in production at scale

Check out the detailed guides on Kubeadm and EKS on the author's profile.

Top comments (0)