Setting Up Your Environment
Before we dive into Kubernetes, let’s set up your local development environment. We’ll install the necessary tools and create your first cluster.
Installing kubectl
kubectl is the command-line tool for interacting with Kubernetes clusters.
macOS
brew install kubectlLinux
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectlWindows
choco install kubernetes-cliVerify the installation:
kubectl version --clientInstalling Minikube
Minikube runs a single-node Kubernetes cluster locally, perfect for development and learning.
macOS
brew install minikubeLinux
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64sudo install minikube-linux-amd64 /usr/local/bin/minikubeWindows
choco install minikubeStarting Your First Cluster
Start Minikube with the following command:
minikube startThis process will:
- Download the Kubernetes components
- Create a virtual machine
- Configure kubectl to connect to your new cluster
Check the cluster status:
kubectl cluster-infokubectl get nodesYou should see output indicating your cluster is running:
NAME STATUS ROLES AGE VERSIONminikube Ready control-plane 1m v1.28.0Verifying Your Setup
Let’s verify everything is working correctly by deploying a simple application:
kubectl create deployment hello-minikube --image=kicbase/echo-server:1.0kubectl expose deployment hello-minikube --type=NodePort --port=8080Access the application:
minikube service hello-minikubeThis will open your browser with the running application.
Useful Minikube Commands
Here are some helpful commands for managing your Minikube cluster:
# Stop the clusterminikube stop
# Delete the clusterminikube delete
# View Minikube dashboardminikube dashboard
# SSH into the Minikube VMminikube sshAlternative Options
While Minikube is great for learning, you have other options:
- kind (Kubernetes in Docker) - Runs Kubernetes in Docker containers
- k3s - Lightweight Kubernetes distribution
- Docker Desktop - Includes Kubernetes support
- Cloud providers - GKE, EKS, AKS for production environments
Next Steps
Now that your environment is set up, let’s explore Kubernetes core concepts in the next section.