- Published on
The Essential 10% of Kubernetes That Explains 90% of Container Orchestration
22 min read
- Authors
- Name
- Bhakta Bahadur Thapa
- @Bhakta7thapa
Table of Contents
- The Essential 10% of Kubernetes That Explains 90% of Container Orchestration
- 🎯 Why This 10% Matters
- 1. 🏗️ Pods: The Atomic Unit
- The Essential Pod Concept
- When I Use Pods Directly
- 2. 🚀 Deployments: Managing Pod Lifecycles
- Essential Deployment Pattern
- Rolling Updates in Action
- 3. 🌐 Services: Stable Network Endpoints
- The Three Essential Service Types
- 1. ClusterIP (Internal Communication)
- 2. NodePort (External Access - Simple)
- 3. LoadBalancer (External Access - Production)
- 4. 🗂️ ConfigMaps & Secrets: Configuration Management
- ConfigMaps for Non-Sensitive Data
- Secrets for Sensitive Data
- 5. 🏠 Namespaces: Multi-Tenancy and Organization
- Essential Namespace Strategy
- Resource Quotas (Production Essential)
- 6. 🔍 Labels & Selectors: The Kubernetes Glue
- Essential Labeling Strategy
- Powerful Label Queries
- 7. 📦 Ingress: HTTP/HTTPS Routing
- Essential Ingress Pattern
- 8. 💾 Persistent Volumes: Stateful Storage
- The Storage Trilogy
- 1. PersistentVolume (PV) - The Storage
- 2. PersistentVolumeClaim (PVC) - The Request
- 3. Using in Pod/Deployment
- 9. 🔧 kubectl: Your Kubernetes Swiss Army Knife
- The Essential kubectl Commands
- Essential kubectl Productivity Tips
- 10. 🏥 Health Checks: Keeping Apps Healthy
- The Three Types of Probes
- 1. Liveness Probe - "Is the app alive?"
- 2. Readiness Probe - "Is the app ready for traffic?"
- 3. Startup Probe - "Has the app started?" (Kubernetes 1.16+)
- Application Health Endpoints
- 🎯 The Complete Example: Putting It All Together
- 🚀 Your Next Steps
- 1. Set Up a Learning Environment
- 2. Practice the Fundamentals
- 3. Master kubectl
- 4. Build Production Skills
- 🎯 Key Takeaways
- 🎓 What's Next?
The Essential 10% of Kubernetes That Explains 90% of Container Orchestration
Deployed hundreds of applications on Kubernetes across banking and enterprise environments, I've learned that mastering just 10% of Kubernetes concepts gives you 90% of the power you need for container orchestration.
This guide focuses on the absolutely essential concepts that form the foundation of everything else in Kubernetes. Master these, and you'll understand how to deploy, scale, and manage containerized applications in production.
🎯 Why This 10% Matters
After working with Kubernetes for 5+ years, I've observed that most engineers struggle because they try to learn everything at once. The reality is:
- 90% of production workloads use the same core patterns
- Most complexity comes from not understanding the fundamentals
- These 10% concepts appear in every Kubernetes deployment
Let's dive into the essential building blocks.
1. 🏗️ Pods: The Atomic Unit
What it is: The smallest deployable unit in Kubernetes. A Pod wraps one or more containers that share storage and network.
Why it matters: Everything in Kubernetes runs inside Pods. Understanding Pods is understanding Kubernetes.
The Essential Pod Concept
# Essential Pod structure
apiVersion: v1
kind: Pod
metadata:
name: web-app
labels:
app: web-app
spec:
containers:
- name: web-container
image: nginx:1.21
ports:
- containerPort: 80
resources:
requests:
memory: '64Mi'
cpu: '250m'
limits:
memory: '128Mi'
cpu: '500m'
Key Insight: Pods are ephemeral. They come and go. Never rely on a specific Pod staying alive forever.
When I Use Pods Directly
- Debugging and troubleshooting
- One-off tasks or batch jobs
- Testing container configurations
2. 🚀 Deployments: Managing Pod Lifecycles
What it is: A controller that manages multiple identical Pods, handles rolling updates, and ensures desired state.
Why it matters: 95% of applications should use Deployments, not raw Pods.
Essential Deployment Pattern
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app-deployment
spec:
replicas: 3 # Always run 3 copies
selector:
matchLabels:
app: web-app
template:
metadata:
labels:
app: web-app
spec:
containers:
- name: web-app
image: myapp:v1.2.3
ports:
- containerPort: 8080
livenessProbe: # Essential for production
httpGet:
path: /health
port: 8080
readinessProbe: # Essential for zero-downtime deployments
httpGet:
path: /ready
port: 8080
Key Insight: Deployments give you declarative management. You declare what you want, Kubernetes figures out how to get there.
Rolling Updates in Action
# Update your application
kubectl set image deployment/web-app-deployment web-app=myapp:v1.2.4
# Check rollout status
kubectl rollout status deployment/web-app-deployment
# Rollback if needed
kubectl rollout undo deployment/web-app-deployment
3. 🌐 Services: Stable Network Endpoints
What it is: A stable way to access Pods, providing load balancing and service discovery.
Why it matters: Pods have dynamic IPs. Services provide stable endpoints that don't change.
The Three Essential Service Types
1. ClusterIP (Internal Communication)
apiVersion: v1
kind: Service
metadata:
name: web-app-service
spec:
selector:
app: web-app
ports:
- port: 80 # Service port
targetPort: 8080 # Pod port
type: ClusterIP # Default - internal only
2. NodePort (External Access - Simple)
apiVersion: v1
kind: Service
metadata:
name: web-app-nodeport
spec:
selector:
app: web-app
ports:
- port: 80
targetPort: 8080
nodePort: 30080 # Access via any node IP:30080
type: NodePort
3. LoadBalancer (External Access - Production)
apiVersion: v1
kind: Service
metadata:
name: web-app-lb
spec:
selector:
app: web-app
ports:
- port: 80
targetPort: 8080
type: LoadBalancer # Cloud provider creates load balancer
Key Insight: Services use label selectors to find Pods. This loose coupling is what makes Kubernetes powerful.
4. 🗂️ ConfigMaps & Secrets: Configuration Management
What it is: Ways to inject configuration data into Pods without rebuilding container images.
Why it matters: Never hardcode configuration in container images. This violates the 12-factor app principles.
ConfigMaps for Non-Sensitive Data
# Create ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
database_url: 'postgresql://db:5432/myapp'
log_level: 'info'
feature_flags: 'new_ui=true,analytics=false'
# Use in Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
spec:
template:
spec:
containers:
- name: web-app
image: myapp:latest
envFrom:
- configMapRef:
name: app-config
# OR specific values
env:
- name: LOG_LEVEL
valueFrom:
configMapKeyRef:
name: app-config
key: log_level
Secrets for Sensitive Data
# Create Secret (base64 encoded)
apiVersion: v1
kind: Secret
metadata:
name: app-secrets
type: Opaque
data:
db_password: cGFzc3dvcmQxMjM= # password123 encoded
api_key: bXlfc2VjcmV0X2FwaV9rZXk=
# Create Secret from command line (easier)
kubectl create secret generic app-secrets \
--from-literal=db_password=password123 \
--from-literal=api_key=my_secret_api_key
Key Insight: ConfigMaps and Secrets can be mounted as files or injected as environment variables.
5. 🏠 Namespaces: Multi-Tenancy and Organization
What it is: Virtual clusters within a physical cluster for organizing and isolating resources.
Why it matters: Essential for organizing environments and resource isolation in production.
Essential Namespace Strategy
# Development namespace
apiVersion: v1
kind: Namespace
metadata:
name: development
labels:
environment: dev
---
# Production namespace
apiVersion: v1
kind: Namespace
metadata:
name: production
labels:
environment: prod
# Work with specific namespace
kubectl get pods -n production
kubectl apply -f app.yaml -n development
# Set default namespace
kubectl config set-context --current --namespace=development
Resource Quotas (Production Essential)
apiVersion: v1
kind: ResourceQuota
metadata:
name: production-quota
namespace: production
spec:
hard:
requests.cpu: '100' # Total CPU requests
requests.memory: 200Gi # Total memory requests
limits.cpu: '200' # Total CPU limits
limits.memory: 400Gi # Total memory limits
pods: '50' # Maximum pods
Key Insight: Use namespaces to separate environments (dev, staging, prod) or teams/projects.
6. 🔍 Labels & Selectors: The Kubernetes Glue
What it is: Key-value pairs that identify and group resources. Selectors use labels to find resources.
Why it matters: Labels are how everything connects in Kubernetes. They're the "glue" of the system.
Essential Labeling Strategy
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
labels:
app: web-app
version: v1.2.3
environment: production
component: frontend
team: platform
spec:
selector:
matchLabels:
app: web-app # Deployment finds Pods with this label
version: v1.2.3
template:
metadata:
labels:
app: web-app # Pods get these labels
version: v1.2.3
environment: production
component: frontend
Powerful Label Queries
# Find all production apps
kubectl get pods -l environment=production
# Find specific app and version
kubectl get pods -l app=web-app,version=v1.2.3
# Find apps NOT in development
kubectl get pods -l environment!=development
# Complex queries
kubectl get pods -l 'environment in (staging,production)'
Key Insight: Consistent labeling is crucial. Establish a labeling convention and stick to it.
7. 📦 Ingress: HTTP/HTTPS Routing
What it is: Manages external HTTP(S) access to services, providing features like SSL termination and path-based routing.
Why it matters: The proper way to expose web applications to the internet.
Essential Ingress Pattern
# First, you need an Ingress Controller (nginx, traefik, etc.)
# Then create Ingress rules
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web-app-ingress
annotations:
kubernetes.io/ingress.class: 'nginx'
cert-manager.io/cluster-issuer: 'letsencrypt-prod'
spec:
tls:
- hosts:
- myapp.example.com
secretName: myapp-tls
rules:
- host: myapp.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web-app-service
port:
number: 80
- path: /api
pathType: Prefix
backend:
service:
name: api-service
port:
number: 8080
Key Insight: Ingress requires an Ingress Controller. Popular choices: nginx-ingress, Traefik, or cloud-provider controllers.
8. 💾 Persistent Volumes: Stateful Storage
What it is: Persistent storage that survives Pod restarts and rescheduling.
Why it matters: Essential for databases and any application that needs to persist data.
The Storage Trilogy
1. PersistentVolume (PV) - The Storage
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-pv
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: fast-ssd
hostPath: # Don't use in production - use cloud storage
path: /data/postgres
2. PersistentVolumeClaim (PVC) - The Request
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: fast-ssd
3. Using in Pod/Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1 # Stateful apps typically run single replica
template:
spec:
containers:
- name: postgres
image: postgres:13
env:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secret
key: password
volumeMounts:
- name: postgres-storage
mountPath: /var/lib/postgresql/data
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: postgres-pvc
Key Insight: Use StorageClasses for dynamic provisioning in cloud environments.
9. 🔧 kubectl: Your Kubernetes Swiss Army Knife
What it is: The command-line tool for interacting with Kubernetes clusters.
Why it matters: You'll use kubectl every single day. These commands are essential.
The Essential kubectl Commands
# Cluster information
kubectl cluster-info
kubectl get nodes
kubectl get namespaces
# Working with resources
kubectl get pods # List pods
kubectl get pods -o wide # More details
kubectl describe pod <pod-name> # Detailed info
kubectl logs <pod-name> # View logs
kubectl logs -f <pod-name> # Follow logs
# Create and apply
kubectl apply -f deployment.yaml # Apply configuration
kubectl delete -f deployment.yaml # Delete resources
# Debugging
kubectl exec -it <pod-name> -- /bin/bash # Shell into pod
kubectl port-forward <pod-name> 8080:80 # Local port forwarding
# Scaling
kubectl scale deployment <name> --replicas=5
# Updates
kubectl set image deployment/<name> container=image:tag
kubectl rollout status deployment/<name>
kubectl rollout undo deployment/<name>
Essential kubectl Productivity Tips
# Set up aliases (add to ~/.bashrc or ~/.zshrc)
alias k=kubectl
alias kgp='kubectl get pods'
alias kgs='kubectl get services'
alias kgd='kubectl get deployments'
# Use short names
kubectl get po # pods
kubectl get svc # services
kubectl get deploy # deployments
kubectl get ns # namespaces
# Watch for changes
kubectl get pods -w # Watch pods change in real-time
# Multiple resources
kubectl get pods,services,deployments
Key Insight: Learn kubectl autocompletion and aliases. They'll save you hours every week.
10. 🏥 Health Checks: Keeping Apps Healthy
What it is: Mechanisms for Kubernetes to determine if your application is healthy and ready to receive traffic.
Why it matters: Essential for zero-downtime deployments and automatic failure recovery.
The Three Types of Probes
1. Liveness Probe - "Is the app alive?"
livenessProbe:
httpGet:
path: /health # Your health endpoint
port: 8080
initialDelaySeconds: 30 # Wait before first check
periodSeconds: 10 # Check every 10 seconds
timeoutSeconds: 5 # Timeout after 5 seconds
failureThreshold: 3 # Restart after 3 failures
2. Readiness Probe - "Is the app ready for traffic?"
readinessProbe:
httpGet:
path: /ready # Your readiness endpoint
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
3. Startup Probe - "Has the app started?" (Kubernetes 1.16+)
startupProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 30 # Allow 5 minutes for startup
Application Health Endpoints
// Example Node.js health endpoints
app.get('/health', (req, res) => {
// Check if app is running and can handle requests
res.status(200).json({ status: 'healthy', timestamp: new Date() });
});
app.get('/ready', (req, res) => {
// Check if app is ready (database connected, etc.)
if (database.isConnected()) {
res.status(200).json({ status: 'ready' });
} else {
res
.status(503)
.json({ status: 'not ready', reason: 'database disconnected' });
}
});
Key Insight: Always implement health checks in production. They're the difference between reliable and unreliable deployments.
🎯 The Complete Example: Putting It All Together
Here's a production-ready example that uses all these concepts:
# Namespace
apiVersion: v1
kind: Namespace
metadata:
name: web-app-prod
---
# ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: web-app-config
namespace: web-app-prod
data:
database_url: 'postgresql://db:5432/webapp'
log_level: 'info'
---
# Secret
apiVersion: v1
kind: Secret
metadata:
name: web-app-secrets
namespace: web-app-prod
type: Opaque
data:
db_password: cGFzc3dvcmQxMjM=
---
# Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
namespace: web-app-prod
labels:
app: web-app
version: v1.0.0
environment: production
spec:
replicas: 3
selector:
matchLabels:
app: web-app
template:
metadata:
labels:
app: web-app
version: v1.0.0
environment: production
spec:
containers:
- name: web-app
image: myapp:v1.0.0
ports:
- containerPort: 8080
env:
- name: DATABASE_URL
valueFrom:
configMapKeyRef:
name: web-app-config
key: database_url
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: web-app-secrets
key: db_password
resources:
requests:
memory: '256Mi'
cpu: '250m'
limits:
memory: '512Mi'
cpu: '500m'
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
---
# Service
apiVersion: v1
kind: Service
metadata:
name: web-app-service
namespace: web-app-prod
spec:
selector:
app: web-app
ports:
- port: 80
targetPort: 8080
type: ClusterIP
---
# Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web-app-ingress
namespace: web-app-prod
annotations:
kubernetes.io/ingress.class: 'nginx'
cert-manager.io/cluster-issuer: 'letsencrypt-prod'
spec:
tls:
- hosts:
- webapp.example.com
secretName: webapp-tls
rules:
- host: webapp.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web-app-service
port:
number: 80
🚀 Your Next Steps
Now that you understand the essential 10%, here's how to apply this knowledge:
1. Set Up a Learning Environment
# Install kind (Kubernetes in Docker)
brew install kind # macOS
# or download from https://kind.sigs.k8s.io/
# Create a cluster
kind create cluster --name learning
# Install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
2. Practice the Fundamentals
- Create a simple Pod and understand its lifecycle
- Deploy an application using Deployment
- Expose it using Service and Ingress
- Configure it using ConfigMaps and Secrets
- Scale it up and down
- Update it with rolling deployments
3. Master kubectl
- Practice the essential commands daily
- Set up aliases and autocompletion
- Learn to debug with
describe
,logs
, andexec
4. Build Production Skills
- Always use health checks
- Implement proper resource limits
- Use namespaces for organization
- Follow labeling conventions
🎯 Key Takeaways
These 10 concepts form the foundation of Kubernetes:
- Pods - The atomic unit
- Deployments - Managing Pod lifecycles
- Services - Stable networking
- ConfigMaps & Secrets - Configuration management
- Namespaces - Organization and isolation
- Labels & Selectors - The connection system
- Ingress - HTTP routing
- Persistent Volumes - Stateful storage
- kubectl - Your command-line interface
- Health Checks - Application reliability
Master these 10 concepts, and you'll understand 90% of what you need to deploy, scale, and manage applications in Kubernetes. The remaining complexity builds on this foundation.
🎓 What's Next?
Once you're comfortable with these fundamentals, explore:
- Helm for package management
- Operators for complex applications
- Service Mesh (Istio) for microservices
- Monitoring with Prometheus and Grafana
- GitOps with ArgoCD
But remember: master the fundamentals first. Everything else builds on these core concepts.
Have questions about any of these concepts? Drop them in the comments below! I'm here to help you master Kubernetes container orchestration.
Want to learn more about DevOps and cloud technologies? Subscribe to my newsletter for weekly insights and practical tutorials!
Tags: #Kubernetes #ContainerOrchestration #DevOps #CloudNative #Docker #K8s