Nslookup in a busybox POD

According to the Mock Exam part 2 in the question 7.
The question sais

Create an nginx pod called nginx-resolver using image nginx , expose it internally with a service called nginx-resolver-service . Test that you are able to look up the service and pod names from within the cluster. Use the image: busybox:1.28 for dns lookup. Record results in /root/nginx.svc and /root/nginx.pod

I’ve create the pod, with this command
kubectl run nginx-resolver --image:nginx
I’ve exposed the service with this command
kubectl expose pod/nginx-resolver --port=80 --target-port=80 --type=ClusterIP --name=nginx-resolver-service
And when I was trying to know the dns from the service , I’ve created a busybox POD with this command
kubectl run busybox --image=busybox:1.28 --rm -it – nslookup nginx-resolver-service . The POD has never came back the result of this operation.
Is there any wrong for me or the problem is the lab?


Hello juanpi,
Please check the following:

kubectl run test-ns --image=busybox:1.28 --rm -it --restart=Never -- nslookup nginx-resolver-service > /root/nginx.svc