What is Kubernetes? Kubernetes is a platform used to:
π It handles everything needed to run apps reliably.
Why Kubernetes is Needed Modern apps have:
Problems without Kubernetes:
Solution: Kubernetes automates:
A cluster has 2 main parts:
Components:
Components:
Real clusters need:
π Not suitable for laptops
| Tool | Characteristics |
|---|---|
| Minikube | Single node, Beginner friendly |
| k3s | Lightweight Kubernetes |
| k3d | Runs k3s in Docker, Fast and easy |
| kind | Kubernetes in Docker, Good for testing |
curl -LO https://dl.k8s.io/release/stable/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
kubectl version --client
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
k3d cluster create mycluster
kubectl get nodes

What is kubectl? CLI tool to interact with Kubernetes.
Cluster Connection
kubectl uses: ~/.kube/config
Contains:
View Clusters
kubectl config get-contexts
Switch Cluster
kubectl config use-context k3d-mycluster
View Nodes:
kubectl get nodes
View Pods:
kubectl get pods
Run Container:
kubectl run nginx --image=nginx
Pod Details:
kubectl describe pod nginx
Logs:
kubectl logs nginx

Create Deployment:
kubectl create deployment web --image=nginx
Scale App:
kubectl scale deployment web --replicas=3
Expose App:
kubectl expose deployment web --port=80 --type=NodePort
Access App:
kubectl port-forward service/web 8080:80
Delete:
kubectl delete pod nginx
kubectl delete deployment web

3 Main Sections:
Current Context:
current-context: k3d-mycluster
kubeconfigkubectl not working:
Fix:
kubectl config use-context <correct-cluster>
Kubernetes manages containers automatically.
π₯ One-Line Memory Trick:
Kubernetes = βSystem that ensures your app runs exactly how you defined.β
| β Previous Class | Next Class β | Theory Index |