Before you can learn Kubernetes properly, you need a local environment where you can break things without consequences. Minikube gives you a single-node Kubernetes cluster on your laptop. It is perfect for learning because it behaves like a real cluster.
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube-linux-amd64 && sudo mv minikube-linux-amd64 /usr/local/bin/minikube
minikube start
kubectl run my-nginx --image=nginx --port=80
kubectl get pods
kubectl describe pod my-nginx
kubectl logs my-nginx
kubectl port-forward pod/my-nginx 8080:80
Open http://localhost:8080 in your browser. You should see the nginx welcome page. That is your first application running on Kubernetes. Clean up with kubectl delete pod my-nginx.
In Part 3, we will learn about Deployments — the proper way to run applications with automatic scaling and self-healing.
← Back to Blog