Resolve Service and External DNS Using a Temporary Pod
Scenario
A Service named earth-svc exists in the planet namespace. Use a temporary Pod to perform DNS resolution tasks and save the results to the dev-machine.
Task
- Create a temporary Pod named
dns-resolveusing thebusybox:latestimage in theplanetnamespace. From this Pod, runnslookupto resolve the FQDN ofearth-svcand save the full output to :
/home/laborant/earth-svc-ip.txt
- Verify the saved IP matches the Service's actual
ClusterIP - From the same temporary Pod, execute nslookup
google.comand save the entire output to :
/home/laborant/google.txt
- Confirm the Pod is automatically removed after the tasks are complete
Hint 1
- The fully qualified domain name (FQDN) of a Service follows the format
<service-name>.<namespace>.svc.cluster.local. - Use
kubectl runwith-it,--restart=Never, and--rmto create a temporary Pod and pipe thenslookupoutput.
See the official docs: DNS for Services and Pods