Introduction
Kubernetes (K8s) is an open-source container orchestration platform. It automates deployment, scaling, and management of containerized applications across clusters of machines.
Key Concepts
- Cluster: A set of machines running Kubernetes
- Node: A single machine in the cluster
- Pod: The smallest deployable unit, containing one or more containers
- Service: An abstraction that exposes pods as a network service
- Deployment: Manages replica sets and rolling updates
Installation
# Install kubectl
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/
# Minikube for local development
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
# Start cluster
minikube start
Basic Commands
# Get cluster info
kubectl cluster-info
# View nodes
kubectl get nodes
# View all resources
kubectl get all
# Deploy an app
kubectl create deployment nginx --image=nginx
# Expose deployment
kubectl expose deployment nginx --port=80 --type=NodePort
Summary
Kubernetes orchestrates containers at scale. Start with Minikube for local development, learn basic kubectl commands, and understand the pod-deployment-service hierarchy.
YouTip