https://drive.google.com/file/d/1egvAeNLA0xnF15gRdJm4SYII1XIr68m8/view?usp=sharing
tshoot-deployment.yaml)# Deployment labels
template:
metadata:
labels:
app: nginx # ← Pods have "app: nginx"
# Service selector
spec:
selector:
app: ngimx # ← TYPO! Should be "nginx"
🚨 Result:
- Service exists, but Endpoints =
<none>curl http://<service-ip>→ connection timeout
# 1. Deploy the broken YAML
kubectl apply -f tshoot-deployment.yaml
# 2. Check Service Endpoints
kubectl get endpoints nginx-deployment-service
# NAME ENDPOINTS AGE
# nginx-deployment-service <none> 10s ← NO PODS!
# 3. Verify Pod labels
kubectl get pods --show-labels
# Labels: app=nginx
# 4. Verify Service selector
kubectl get svc nginx-deployment-service -o yaml | grep -A 2 selector
# selector:
# app: ngimx ← TYPO!
# 5. Test connectivity (will hang/time out)
kubectl run debug --image=curlimages/curl -it --rm -- sh
# curl <http://nginx-deployment-service> ← hangs
# Correct the Service selector
spec:
selector:
app: nginx # ← Fixed typo
💡 Pro Tip: Always use kubectl get endpoints <service> to verify Pod linkage.
tshoot-deployment-svc.yaml)apiVersion: apps/v1
kind: Deployment
meta
name: nginx-deployment
# ... (valid Deployment)
---
# ❌ NO SERVICE DEFINED IN YAML!
# Only a comment: "expose this deployment with a service..."
🚨 Result:
- Deployment runs, but no Service exists
- No way to access Pods (except direct Pod IP)
# 1. Apply the YAML (only creates Deployment)
kubectl apply -f tshoot-deployment-svc.yaml
# 2. Check for Services
kubectl get svc
# No service named "my-nginx-web-svc"!
# 3. Try to access (fails)
kubectl run debug --image=curlimages/curl -it --rm -- sh
# curl <http://my-nginx-web-svc> ← "Could not resolve host"