Kubernetes 101 : Testing a kubernetes service reachability with "nslookup"



Testing a service accessibility:

We use the below command to create both a service and a pod with the nginx image: 


The nginx-1 service has an IP address and a DNS name nginx-1.

We can check if the service is accessible f
rom inside a newly created debian container using the nslookup tool:


--rm: removes the pod when it exits.
--restart: is the restart policy when the pod crashes for example, in the above example it is set to "never".

We get the below results which show that our service is reachable through the DNS server below "10.11.50.9":


We can also see the service name "nginx-1.default.svc.cluster.local", 
"default" is the name of the default namespace of kubernetes, where our service lives.

Comments

Leave as a comment:

Archive