Kubernetes can seem overwhelming, but deploying your first application is simpler than you think. This beginner-friendly guide gets you from zero to deployed in 10 minutes.
Prerequisites
# Install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
# Install minikube for local development
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
# Start cluster
minikube startCore Concepts
- Pod: Smallest deployable unit, runs one or more containers
- Deployment: Manages pod replicas and rolling updates
- Service: Exposes pods to network traffic
- ConfigMap/Secret: External configuration
Step 1: Create a Deployment
# 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: my-app
image: nginx:alpine
ports:
- containerPort: 80
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 10kubectl apply -f deployment.yaml
kubectl get pods -w # Watch pods come upStep 2: Expose with a Service
# service.yaml
apiVersion: v1
kind: Service
metadata:
name: my-app-service
spec:
selector:
app: my-app
ports:
- port: 80
targetPort: 80
type: LoadBalancerkubectl apply -f service.yaml
minikube service my-app-service # Opens in browserStep 3: Configure with ConfigMaps
kubectl create configmap app-config \
--from-literal=APP_ENV=production \
--from-literal=LOG_LEVEL=infoEssential kubectl Commands
# View resources
kubectl get pods,svc,deploy
kubectl describe pod my-app-xxx
kubectl logs my-app-xxx -f
# Scaling
kubectl scale deployment my-app --replicas=5
# Rolling update
kubectl set image deployment/my-app my-app=nginx:latest
kubectl rollout status deployment/my-app
# Rollback
kubectl rollout undo deployment/my-app
# Debug
kubectl exec -it my-app-xxx -- /bin/sh
kubectl port-forward svc/my-app-service 8080:80Common Pitfalls
- Not setting resource limits (leads to noisy neighbors)
- Using
latesttag (not reproducible) - Skipping health checks (slow failure detection)
- Hardcoding configuration (use ConfigMaps and Secrets)
Conclusion
Kubernetes is the industry standard for container orchestration. Start with these basics, then explore Helm charts, Ingress controllers, and GitOps workflows as you grow.

Leave a Reply