1] From student-node ssh cluster1-controlplane to solve this question.
Create an nginx pod called nginx-resolver using the image nginx and 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 cluster1-
cat /root/CKA/nginx.pod
Server: 172.20.0.10
Address 1: 172.20.0.10 kube-dns.kube-system.svc.cluster.local
Name: 172-17-1-20.default.pod.cluster.local
Address 1: 172.17.1.20 172-17-1-20.nginx-resolver-service.default.svc.cluster.local
pod “test1” deleted from default namespace
controlplane ~ ➜ cat /root/CKA/nginx.svc
Server: 172.20.0.10
Address 1: 172.20.0.10 kube-dns.kube-system.svc.cluster.local
Name: nginx-resolver-service
Address 1: 172.20.57.116 nginx-resolver-service.default.svc.cluster.local
pod “test1” deleted from default namespace dont knnow what is gong wrong
got this when i checked the file but also the lab marks it wrong dont know what goes wrong
cmds used by me are
Create the pod
kubectl run nginx-resolver --image=nginx --labels=app=nginx-resolver
Expose it as a service
kubectl expose pod nginx-resolver --name=nginx-resolver-service --port=80 --target-port=80
kubectl run test-dns --image=busybox:1.28 --rm -it – restart=Never – nslookup nginx-resolver-service > /root/CKA/nginx.svc
kubectl run test-dns --image=busybox:1.28 --rm -it – restart=Never – nslookup ${POD_IP}.default.pod.cluster.local > /root/CKA/nginx.pod