kubectl exec -it mysql-0 -- mysql -uroot -prootpass
Enter fullscreen mode
Exit fullscreen mode
Inside MySQL:
CREATE DATABASE labdb; USE labdb; CREATE TABLE test (id INT); INSERT INTO test VALUES (1); SELECT * FROM test;
Enter fullscreen mode
Exit fullscreen mode
Exit:
exit
Enter fullscreen mode
Exit fullscreen mode
STEP 9 — DELETE POD, DATA MUST SURVIVE
kubectl delete pod mysql-0
Enter fullscreen mode
Exit fullscreen mode
Wait until it comes back:
kubectl get pods -w
Enter fullscreen mode
Exit fullscreen mode
Reconnect:
kubectl exec -it mysql-0 -- mysql -uroot -prootpass
Enter fullscreen mode
Exit fullscreen mode
Check:
USE labdb; SELECT * FROM test;
Enter fullscreen mode
Exit fullscreen mode
✅ Data is still there.
VISUAL: DATA SURVIVES POD DELETION
STEP 10 — WHAT THIS LAB PROVES (LOCK THIS IN)
Kubernetes guarantees:
Stable pod identity
Ordered startup & shutdown
Persistent storage
Predictable DNS
Kubernetes does NOT:
Replicate MySQL data
Promote replicas
Manage DB internals
SENIOR DEVOPS MENTAL MODEL (INTERVIEW READY)
“StatefulSets are required for databases because they provide stable pod identities and ordered lifecycle management. Headless services expose pod-level DNS so clients can target specific replicas. VolumeClaimTemplates ensure each pod has persistent storage that survives restarts.”
For further actions, you may consider blocking this person and/or reporting abuse
Залишити відповідь