Can we setup kubernetees in laptop. Give steps to do so
Yes. For your Kubernetes fundamentals practice, you can run a complete Kubernetes cluster locally on your laptop. You do not need AWS for this.
For your Windows laptop, I’d use Docker Desktop + Kubernetes for the simplest setup.
Setup
-
Install Docker Desktop
- Download and install Docker Desktop for Windows.
- During installation, use the WSL 2 backend.
- Restart if prompted.
-
Enable Kubernetes
- Open Docker Desktop.
- Go to Settings → Kubernetes.
- Enable Kubernetes.
- Apply/restart and wait until Kubernetes shows as running.
- Verify from PowerShell
kubectl version --client
Then:
kubectl get nodes
You should see something similar to:
NAME STATUS ROLES AGE
docker-desktop Ready control-plane ...
- Run your first Pod
kubectl run nginx --image=nginx
Check:
kubectl get pods
You should see:
nginx 1/1 Running
- Create a Deployment
kubectl create deployment nginx-deployment --image=nginx --replicas=3
Then:
kubectl get deployments
kubectl get pods
You should now have three Pods.
- Create a Service
kubectl expose deployment nginx-deployment --port=80
Check:
kubectl get services
You’ll see a ClusterIP Service.
Your local architecture
Docker Desktop
│
Kubernetes Cluster
│
└── Node
│
├── Deployment
│ │
│ └── ReplicaSet
│ ├── Pod → nginx
│ ├── Pod → nginx
│ └── Pod → nginx
│
└── Service
│
└── Pods
This is perfect for the fundamentals you’re currently learning: Pods, Deployments, ReplicaSets, Services, labels/selectors, scaling, and self-healing.
You can later move to Minikube, Kind, or a multi-node setup when you want to learn networking, ingress, storage, or more realistic cluster administration. For now, don’t build a miniature Google data center in your laptop. 😄
Good. 👍 That confirms the Kubernetes installation itself is fine. The problem was simply that kubectl was pointing at the wrong context.
Now continue with the basic validation:
kubectl get nodes
kubectl get pods -A
You should see the Docker Desktop node in Ready state.
Then let’s do the first real Kubernetes exercise:
kubectl create deployment nginx --image=nginx --replicas=3
kubectl get deployments
kubectl get pods
This will let you see the Deployment → ReplicaSet → 3 Pods relationship we just discussed, rather than merely admiring an empty cluster. 😄
ok. Locally deployed and checked the service from the browser. Did port forwarding to check it from the browser
Perfect. 👍 That gives you the complete first hands-on flow:
Docker Desktop → Kubernetes cluster → Node → Deployment → ReplicaSet → 3 Pods → Service → Port Forward → Browser
You have now practically validated the core concepts we discussed.
One important distinction
Your browser access through:
kubectl port-forward service/nginx 8080:80
is local access through kubectl, not external exposure of the Kubernetes Service.
So you’ve demonstrated:
- Deployment → maintains 3 replicas
- Pods → actually run nginx
- Service → provides a stable endpoint for the Pods
- Port forwarding → temporarily exposes that Service to your laptop/browser
Next useful step
Before moving deeper, I’d do just one more 10-minute exercise:
kubectl scale deployment nginx --replicas=5
kubectl get pods
Then:
kubectl scale deployment nginx --replicas=2
kubectl get pods
This makes Deployment → ReplicaSet → Pods → scaling/self-healing tangible.
After that, your Kubernetes fundamentals session has covered enough. No need to turn a refresher into a three-week pilgrimage through Kubernetes documentation. 😄
Give list of all commands used so far with a one line explanation
Here’s the Kubernetes command list we’ve used so far, in the order you used them:
| Command | One-line explanation |
|---|---|
kubectl version --client | Checks that the kubectl CLI is installed and shows its client version. |
kubectl config get-contexts | Lists the Kubernetes contexts configured on your laptop. |
kubectl config current-context | Shows which Kubernetes context kubectl is currently using. |
kubectl config use-context docker-desktop | Switches kubectl to the Docker Desktop Kubernetes cluster. |
kubectl get nodes | Lists cluster nodes and shows their readiness status. |
kubectl get pods -A | Lists Pods across all namespaces. |
kubectl create deployment nginx --image=nginx --replicas=3 | Creates an nginx Deployment with 3 desired replicas. |
kubectl get deployments | Shows Deployments and their desired/current/ready replica counts. |
kubectl get pods | Lists Pods in the current namespace and their status. |
kubectl expose deployment nginx --port=80 | Creates a Service exposing the nginx Deployment on port 80. |
kubectl get services | Lists Services and their types, cluster IPs, and ports. |
kubectl port-forward service/nginx 8080:80 | Forwards your laptop’s port 8080 to Service port 80, allowing browser access locally. |
kubectl scale deployment nginx --replicas=5 | Changes the Deployment’s desired replica count to 5. |
kubectl scale deployment nginx --replicas=2 | Scales the Deployment back down to 2 replicas. |
The commands worth remembering first
If you’re building your Kubernetes fundamentals cheat sheet, I’d group them like this:
Cluster
kubectl config get-contexts
kubectl config current-context
kubectl config use-context docker-desktop
kubectl get nodes
Workloads
kubectl create deployment nginx --image=nginx --replicas=3
kubectl get deployments
kubectl get pods
kubectl scale deployment nginx --replicas=5
Services
kubectl expose deployment nginx --port=80
kubectl get services
kubectl port-forward service/nginx 8080:80
That’s already enough commands for the fundamentals. The important thing now is understanding what each command changes in the Kubernetes object model, rather than collecting 47 more commands like Pokémon. 😄
