Untitled

Untitled

Untitled

web-service.apps.svc.cluster.local 이 FQDN(Fully Qualified Domain Name) 이다. (= 서비스의 정규화된 도메인 이름이다.)

이것이 클러스터 내에서 서비스가 해결되는 방식이다.

Pod DNS Record

<POD-IP-ADDRESS>.<namespace-name>.pod.cluster.local

# example
# Pod is located in a default namespace
10-244-1-10.default.pod.cluster.local

# to create a namespace
$ k create ns apps

# to create a pod
$k run nginx --image=nginx -n apps

# to create the additional information of the pod in the namespace "apps"
$k get po -n apps -o wide
NAME    READY   STATUS    RESTARTS   AGE   IP           NODE     NOMINATED NODE   READINESS GATES
nginx   1/1     Running   0          99s   10.244.1.3   node01   <none>           <none>

# to get the dns record of the nginx pod from the default namespace
$k run -it test --image=busybox:1.28 -rm --restarr=Never -- nslookup 10-244-1-3.apps.pod.cluster.local
Server:    10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name:      10-244-1-3.apps.pod.cluster.local
Address 1: 10.244.1.3
pod "test" deleted

# accessing with curl command 
$k run -tit nginx-test --image=nginx -rm --restart=Never -- curl -Is <http://10-244-1-3.apps.pod.cluster.local>
HTTP/1.1 200 OK
Server: nginx/1.19.2