Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get FQDN DNS name of a kubernetes service?

How to get a full FQDN of the service inside Kubernetes?

➜ k get svc -o wide  
NAME                     TYPE           CLUSTER-IP       EXTERNAL-IP                             PORT(S)    AGE     SELECTOR
airflow-flower-service   ClusterIP      172.20.119.107   <none>                                  5555/TCP   20d     app=edna-airflow
airflow-service          ClusterIP      172.20.76.63     <none>                                  80/TCP     20d     app=edna-airflow
backend-service          ClusterIP      172.20.39.154    <none>                                  80/TCP     20d     app=edna-backend

so how to query internal Kubernetes DNS to get the FQDN of the backend-service for example?

like image 660
DmitrySemenov Avatar asked Dec 22 '22 16:12

DmitrySemenov


1 Answers

Go inside any pod in the same namespace with kubectl exec -ti <your pod> bash and then run nslookup <your service> which will typically be, unless you change some configurations in the cluster to: yourservice.yournamespace.svc.cluster.local

like image 169
paltaa Avatar answered Dec 27 '22 05:12

paltaa