Lab 4.2 - Service Discovery with DNS
Objectives
By the end of this lab, you will be able to:
- Use the internal DNS
- Resolve Service names
- Test inter-service communication
Exercise: Service Discovery
Step 1: Create a Service
kubectl apply -f service.yaml
Step 2: Test DNS Resolution
# Create a test Pod
kubectl run dns-test --image=busybox --rm -it -- sh
# Inside the Pod, test the resolution
nslookup web-service
nslookup web-service.default.svc.cluster.local
Step 3: Communication
# Inside the test Pod
wget -O- http://web-service
Cleanup
kubectl delete service web-service
Lab created: December 2024