Kubernetes Basics for Developers
Introduction to Kubernetes for managing containerized applications.
What Is Kubernetes?
Kubernetes (K8s) orchestrates containerized applications at scale. Handles deployment, scaling, and management automatically.
Core Concepts
Pod = Smallest unit, one or more containers
Deployment = Manages multiple identical Pods
Service = Exposes Pods to network
Ingress = Routes external traffic
Deployment YAML
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: app
image: my-app:v1
ports:
- containerPort: 3000
kubectl Commands
kubectl apply -f deployment.yaml # Apply configuration
kubectl get pods # List pods
kubectl logs pod-name # View logs
kubectl delete -f deployment.yaml # Delete resources
Conclusion
Kubernetes has a learning curve but provides powerful orchestration. Start with minikube for local development.