Question: Create an nginx pod called `nginx-resolver` using image `nginx`, expos . . .

damoder reddy:
question: 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/CKA/nginx.svc and /root/CKA/nginx.pod
k run test25 --image=busybox:1.28 --rm -it --tty -- nslookup nginx-resolver-service
k run test26 --image=busybox:1.28 --rm -it --tty -- nslookup 10-244-1-7.default.pod

Fernando Jimenez:

-t, --tty=false: Allocated a TTY for each container in the pod.

In case you would like to know, you are repeating the same when you do -it --tty
Another way:

kubectl run tester --image=busybox:1.28 --command sleep 4800
kubectl exec tester -- nslookup nginx-resolver-service > /root/CKA/nginx.svc
kubectl exec tester -- nslookup 10-244-1-7.default.pod > /root/CKA/nginx.pod

Tej_Singh_Rana:
Please add --restart=Never flag

Fernando Jimenez:
@Tej_Singh_Rana why do you feel --restart=Never is necessary?

Tej_Singh_Rana:
when we use --rm without --restart=Never , it gets hang. If we use with it then pod gets removed automatically and we get our desired output in a single command.

Tej_Singh_Rana:
Please try it, you will see difference.

Fernando Jimenez:
I see, you are associating it with the --rm and not with the alternative commands I suggested.