π Mission Debrief: Namespace Confusion¶
What Happened¶
Your resources were deployed to the "default" namespace instead of "k8squest". Namespaces provide isolationβresources in different namespaces can't easily find each other.
How Kubernetes Behaved¶
Namespaces are virtual clusters within a physical cluster:
- Provide scope for names (can have "web" pod in multiple namespaces)
- Enable resource quotas and limits per namespace
- Provide access control boundaries (RBAC per namespace)
- Services can communicate within namespace easily
- Cross-namespace communication requires fully qualified DNS
The Correct Mental Model¶
Namespace isolation:
Cluster
βββ default namespace
β βββ pod: app-1
β βββ service: api
βββ k8squest namespace
β βββ pod: client-app
β βββ service: backend-service
βββ production namespace
βββ pod: payment-processor
βββ service: payment-api
DNS resolution:
- Same namespace: service-name
- Cross-namespace: service-name.namespace-name.svc.cluster.local
Commands You Mastered¶
# List all namespaces
kubectl get namespaces
# View resources in specific namespace
kubectl get all -n <namespace>
# View resources in all namespaces
kubectl get pods --all-namespaces
kubectl get pods -A
# Create namespace
kubectl create namespace <name>
# Set default namespace for context
kubectl config set-context --current --namespace=<namespace>
# Delete namespace (careful!)
kubectl delete namespace <namespace>
Congratulations! π¶
You've completed World 1: Core Kubernetes Basics!
You've mastered: - β CrashLoopBackOff debugging - β ImagePullBackOff resolution - β Resource scheduling (Pending pods) - β Labels and selectors - β Port configuration - β Multi-container pods - β Log-based debugging - β Init containers - β Namespace isolation
Total XP Earned: 1,450 XP
Next: World 2 - Deployments & Scaling awaits!