Kubernetes Fundamentals
Kubernetes (K8s) is the industry standard container orchestration platform — automating deployment, scaling, and management of containerized applications across clusters of servers.
50 min•By Priygop Team•Last updated: Feb 2026
Core K8s Concepts
- Pod — Smallest deployable unit. One or more containers sharing network/storage. Ephemeral (not directly managed)
- Deployment — Manages replicas of pods. Handles rolling updates, rollbacks, desired state. kubectl rollout undo
- Service — Stable network endpoint for pods. Types: ClusterIP (internal), NodePort (external), LoadBalancer (cloud LB)
- Ingress — HTTP routing to services. Define rules: /api → api-service, /app → app-service. Works with Nginx/Traefik
- ConfigMap / Secret — Configuration injection. ConfigMap for non-sensitive; Secret for passwords (base64, ideally encrypted)
- HPA (Horizontal Pod Autoscaler) — Scale pods based on CPU/memory/custom metrics. Min 2, max 10 replicas
- Namespace — Logical cluster isolation. Separate namespaces for dev/staging/production
- Helm — Package manager for Kubernetes. Charts bundle all K8s manifests. helm install my-app ./chart
Kubernetes Manifests
Example
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
namespace: production
spec:
replicas: 3
selector:
matchLabels:
app: web-app
template:
metadata:
labels:
app: web-app
spec:
containers:
- name: web
image: ghcr.io/myorg/web-app:latest
ports:
- containerPort: 3000
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: app-secrets
key: database-url
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 3000
---
# service.yaml
apiVersion: v1
kind: Service
metadata:
name: web-app
spec:
selector:
app: web-app
ports:
- port: 80
targetPort: 3000
---
# hpa.yaml — Auto-scaling
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web-app
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: web-app
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70