Mock - 2 on CKA

Hello Team,

I would your attention on the MOCK exam -2 question. We unable to perform nslookup based question which you provided answer. I suspected issue in the busybox image which doesn’t have dns entry. we getting timeout.

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

Answer →

controlplane $ kubectl run test-nslookup --image=busybox:1.28 --rm -it – nslookup nginx-resolver-service
pod “test-nslookup” deleted
error: timed out waiting for the condition
controlplane $

controlplane $ kubectl describe svc nginx-resolver-service
Name: nginx-resolver-service
Namespace: default
Labels: run=nginx-resolver
Annotations:
Selector: run=nginx-resolver
Type: ClusterIP
IP: 10.100.112.194
Port: 8080/TCP
TargetPort: 8080/TCP
Endpoints: 10.244.1.2:8080
Session Affinity: None
Events:
controlplane $

-----------So I tried with interaction shell and dnsutils which were worked perfectly. I suspect issue in the image which doesn’t have nslookup -------
Request someone fix the issue.

controlplane $ kubectl run testing-nslookup --image=busybox:1.28 -it – sh
If you don’t see a command prompt, try pressing enter.
/ # nslookup nginx-resolver-service
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name: nginx-resolver-service
Address 1: 10.100.112.194 nginx-resolver-service.default.svc.cluster.local
/ # nslookup 10-100-112-194.default.pod
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name: 10-100-112-194.default.pod
Address 1: 10.100.112.194 nginx-resolver-service.default.svc.cluster.local

controlplane $ kubectl exec -i -t dnsutils – nslookup nginx-resolver-service
Server: 10.96.0.10
Address: 10.96.0.10#53

Name: nginx-resolver-service.default.svc.cluster.local
Address: 10.100.112.194

controlplane $ kubectl exec -i -t dnsutils – nslookup 10-100-112-194.default.pod
Server: 10.96.0.10
Address: 10.96.0.10#53

Name: 10-100-112-194.default.pod.cluster.local
Address: 10.100.112.194

Hello, @Manojkumar
Please also add –restart=Never flag.

$ kubectl run test-nslookup --restart=Never --image=busybox:1.28 --rm -it -- nslookup nginx-resolver-service