Mock exam 2 question 7

Mock exam 2 question 7.
Unable to get output for Nslookup when creating pods.

Please try again using those steps:

$ kubectl run --generator=run-pod/v1 nginx-resolver --image=nginx
$ kubectl expose pod nginx-resolver --name=nginx-resolver-service --type=ClusterIP --port=80
$ kubectl run --generator=run-pod/v1 test-ns --image=busybox:1.28 --rm -it --restart=Never -- nslookup nginx-resolver-service > /root/nginx.svc

Get the IP of the nginx-resolver pod and replace the dots(.) with hyphon(-) which will be used below.

$ kubectl get pod nginx-resolver -o wide
$ kubectl run --generator=run-pod/v1 test-ns --image=busybox:1.28 --rm -it --restart=Never -- nslookup  10-44-0-1.default.pod > /root/nginx.pod