Md Ishaq R:
Hi All, can anyone help me to understand this command “kubectl run --image=busybox:1.28 test-lookup --rm -it – nslookup nginx-resolver-service”
Marco Tony:
which part of it is not clear?
Marco Tony:
• kubectl run --image=busybox:1.28 test-lookup
= run a busybox:1.28 as pod named test-lookup
Md Ishaq R:
–rm and --nslookup
Marco Tony:
-- nslookup
is not an option
Md Ishaq R:
test-lookup
Harindha Fernando:
- -rm will remove the pod after execution
Marco Tony:
it’s just saying the argument of the container command is nslookup nginx-resolver-service
Marco Tony:
thanks @Harindha Fernando
Harindha Fernando:
-it will give interactive terminal
Md Ishaq R:
why do we have to mention --image=busybox:1.28 when we have configured the image in the pod
Marco Tony:
when you configured it?
Md Ishaq R:
i mean when you have mentioned in the pod test-lookup
Marco Tony:
yes
Marco Tony:
the command will create a pod named test-lookup
Marco Tony:
it’s based on busybox:1.28
@kodekloud
In general when you want to check for network connectivity after creating a service of type ClusterIp, you need to create a pod in the clister and try to resolve the dns of that service. This is a very important check in the CKA and CKAD exams.
Here is a breakdown:
kubectl run --image=busybox:1.28 test-lookup —> this command creates a temporary pod named “test-lookup” using a busybox image with tag 1.28(this tag is used because it has the capability of doing dns lookup which is the command that comes after --)
-it ----> interactive terminal
–rm —> this deletes the pod once the the interactive session/terminal is closed(this is why it is called a temporary pod)
nslookup nginx-resolver-service ----> tries to resolve the dns of a service called nginx-resolver-service
Ask more questions if this was not very clearly explained. Cheers!