There is some issue with question # 7 for Mock Exam 2 in CKA. Create an nginx po . . .

Aditya Pratap Bhuyan:
There is some issue with question # 7 for Mock Exam 2 in CKA.
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

For this when I am running the command to divert nslookup output the pod is timing out without showing the output

k run --generator=run-pod/v1 ns-test-pod --image=busybox:1.28.0 --rm -it -- nslookup nginx-resolver-service
When I am logging into the pod and using nslookup it is working fine.

Manas Sahoo:
Can you try with 1.28 instead of 1.28.0 : kubectl run test-nslookup --image=busybox:1.28 --rm -it --restart=Never – nslookup nginx-resolver-service

Markeen Rice-Wallace:
2 things.

  1. –generator is deprecated. You don’t have to use it anymore.
  2. The command works, but it won’t output the log to the terminal. If you do a logs on the pod before it gets deleted, that will work fine

Markeen Rice-Wallace:
If I had to guess why it wasn’t outputting, maybe it’s the --rm deleting the pod before it can.

Basavraj Nilkanthe:
@Aditya Pratap Bhuyan This is just matter of restart=Never flag in your imperative command… This is how busybox image works. This is really good time to understand busybox dockerfile to confirm why this require restart=Never flag when we run command in imperative command of kubectl