Script Valley
Kubernetes: From Containers to Clusters
Containers and the Kubernetes FoundationLesson 1.3

How to install kubectl and set up a local Kubernetes cluster with kind

kubectl installation, kubeconfig file, kind tool, local cluster creation, context switching, cluster verification, kubectl get nodes

What You Need

Local Kubernetes setup steps diagram

To follow the rest of this course hands-on, you need two tools: kubectl (the CLI for Kubernetes) and kind (Kubernetes IN Docker — runs a real cluster locally using Docker containers as nodes).

Install kubectl

# macOS (Homebrew)
brew install kubectl

# Linux
curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl && sudo mv kubectl /usr/local/bin/

# Verify
kubectl version --client

Install kind and Create a Cluster

# macOS / Linux
brew install kind

# Create a single-node cluster
kind create cluster --name my-cluster

# Verify nodes are ready
kubectl get nodes
# Output:
# NAME                       STATUS   ROLES           AGE
# my-cluster-control-plane   Ready    control-plane   30s

Understanding kubeconfig

kubectl reads ~/.kube/config to know which cluster to talk to. kind automatically adds a context here when you create a cluster. If you manage multiple clusters, switch between them with:

# List all contexts
kubectl config get-contexts

# Switch to a different context
kubectl config use-context kind-my-cluster

Up next

Kubernetes namespaces: what they are and when to use them

Sign in to track progress