Getting Started with Kubernetes
There are several ways to set up a Kubernetes environment for learning. The quickest is Minikube, which runs a single-node cluster on your local machine.
Option 1: Minikube (Local)
Minikube creates a virtual machine on your computer and runs a single-node Kubernetes cluster inside it.
# Install Minikube (macOS)
brew install minikube
# Install Minikube (Windows)
choco install minikube
# Install Minikube (Linux)
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
# Start the cluster
minikube start
# Verify it is running
kubectl cluster-info
kubectl get nodes
Option 2: Docker Desktop
If you already have Docker Desktop installed, enabling Kubernetes is a single checkbox:
1. Open Docker Desktop settings.
2. Go to Kubernetes tab.
3. Check Enable Kubernetes.
4. Click Apply & Restart.
This installs a single-node cluster using Docker as the container runtime. It is the easiest way to get started on macOS or Windows.
Option 3: Cloud Providers
For a production-like experience, use a managed Kubernetes service:
# Google Kubernetes Engine (GKE)
gcloud container clusters create my-cluster --num-nodes=3
# Amazon Elastic Kubernetes Service (EKS)
eksctl create cluster --name my-cluster --nodes 3
# Azure Kubernetes Service (AKS)
az aks create --resource-group myRG --name myAKSCluster --node-count 3
Most cloud providers offer a free tier, so you can experiment without spending money.
Your First Deployment
Once your cluster is running, try deploying a simple application:
# Deploy nginx
kubectl create deployment nginx --image=nginx
# Check the pod
kubectl get pods
# Expose it on port 80
kubectl expose deployment nginx --port=80 --type=NodePort
# Get the URL
minikube service nginx --url
Visit the URL in your browser and you should see the nginx welcome page. Congratulations — you just deployed your first application on Kubernetes!