If you’re studying for the CKA (Certified Kubernetes Administrator) exam — or just trying to get better at managing real production clusters — chances are you've Googled half of these YAMLs at 2AM.
Let’s save you the trouble.
Here are 5 Kubernetes YAML patterns that show up over and over in interviews, in exam labs, and in real deployments.
1. Basic Deployment with Resource Limits
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 2
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: nginx
image: nginx:latest
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "200m"
memory: "256Mi"
✅ Exam-ready
✅ Production-safe
2. Pod with ConfigMap Mounted as Volume
apiVersion: v1
kind: Pod
metadata:
name: config-demo
spec:
containers:
- name: app
image: busybox
command: ["/bin/sh", "-c", "cat /etc/config/myconfig"]
volumeMounts:
- name: config
mountPath: /etc/config
volumes:
- name: config
configMap:
name: my-configmap
3. Service + Ingress Combo (for HTTP Routing)
apiVersion: v1
kind: Service
metadata:
name: web-svc
spec:
selector:
app: web
ports:
- port: 80
targetPort: 8080
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web-ingress
spec:
rules:
- host: example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web-svc
port:
number: 80
4. Horizontal Pod Autoscaler (HPA)
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: web
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
5. Network Policy to Block All but One Namespace
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: restrict-traffic
spec:
podSelector: {}
ingress:
- from:
- namespaceSelector:
matchLabels:
name: allowed-ns
📘 Want More? Grab the Full CKA Study Guide (Free + Paid Options)
This post is a tiny slice of what’s inside my updated 2025 CKA exam guide. It’s built for engineers who want to actually pass, not just read docs.
🔹 Free Version (Preview)
Download here → Payhip
🔹 Full Edition (50+ Labs + YAML + Traps + 15% Off)
Get it here → Payhip
Use code CKA15SUMMER (expires July 8)
—
Follow me @DynamoDevOps for more clean Kubernetes content.
Top comments (0)