Kubernetes의 서비스 검색 및 DNS
컨테이너가 서로를 찾는 방식을 학습합니다. 클러스터 DNS, Service 객체, 마이크로서비스를 이름으로 접근할 수 있게 하는 확인 흐름을 다룹니다.
Kubernetes의 서비스 검색 및 DNS은(는) CoddyKit의 무료 Linux Networking & TCP/IP for Developers 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Linux Networking & TCP/IP for Developers 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Linux Networking & TCP/IP for Developers 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
The Discovery Problem
Container IPs are ephemeral — pods restart and get new addresses constantly. Hardcoding IPs is impossible.
Service discovery lets workloads find each other by stable names instead of changing IPs.
The Service Abstraction
A Kubernetes Service provides a stable virtual IP (ClusterIP) and DNS name that load-balances across a set of pods selected by labels.
apiVersion: v1
kind: Service
metadata:
name: orders
spec:
selector:
app: orders
ports:
- port: 80Cluster DNS
Every cluster runs a DNS server (CoreDNS). It automatically creates records for each Service so workloads can resolve them by name.
The DNS Naming Scheme
Services follow a predictable FQDN pattern:
service.namespace.svc.cluster.local
Within the same namespace, just orders works. Across namespaces use orders.payments.
curl http://orders.payments.svc.cluster.localHow a Pod Resolves Names
Each pod's /etc/resolv.conf points at the cluster DNS and includes search domains, so short names expand to full Service FQDNs automatically.
cat /etc/resolv.confClusterIP Load Balancing
A ClusterIP is virtual — kube-proxy programs iptables or IPVS rules so traffic to it is distributed across the healthy backing pods. Clients never see individual pod IPs.
Headless Services
Set clusterIP: None for a headless Service. DNS then returns the individual pod IPs directly, which is ideal for stateful sets and client-side load balancing.
spec:
clusterIP: None
selector:
app: dbEndpoints and EndpointSlices
Behind each Service, Kubernetes maintains EndpointSlices listing the ready pod IPs. As pods come and go, these update so DNS and routing stay current.
kubectl get endpointslicesResolving from Inside a Pod
You can debug discovery by running nslookup from a pod to verify a Service name resolves to its ClusterIP.
kubectl exec -it shell -- nslookup ordersExternal Name Services
An ExternalName Service maps a cluster DNS name to an outside hostname via a CNAME, letting you reference external systems with cluster-internal names.
spec:
type: ExternalName
externalName: api.example.comCommon Discovery Failures
When name resolution fails, check:
- Label selector mismatch (no endpoints)
- Wrong namespace in the FQDN
- CoreDNS pods unhealthy
- NetworkPolicy blocking DNS (port 53)
Quick Check
Test your service discovery knowledge.
Recap
You now understand container service discovery:
- Services give stable ClusterIPs and DNS names
- CoreDNS resolves
service.namespace.svc.cluster.local - EndpointSlices track ready pods
- Headless and ExternalName Services for special cases
- Debug with
nslookupfrom inside pods
This builds on your Docker network modes and Kubernetes networking basics.
AI 튜터와 함께 Linux Networking & TCP/IP for Developers을(를) 배우세요 — 무료
브라우저에서 실제 코드를 작성하고 실행하며, 24/7 AI 튜터로부터 즉각적인 도움을 받고, 웹이나 앱에서 중단한 부분부터 계속 학습하세요.
- 코스
- 12
- 레슨
- 48
자주 묻는 질문
“Kubernetes의 서비스 검색 및 DNS” 강의는 무료인가요?
네 — “Kubernetes의 서비스 검색 및 DNS” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Linux Networking & TCP/IP for Developers 강의 전체를 잠금 해제할 수 있습니다. Linux Networking & TCP/IP for Developers 강의에는 총 4개의 강의가 포함되어 있습니다.
“Kubernetes의 서비스 검색 및 DNS”에서 뭘 배우나요?
컨테이너가 서로를 찾는 방식을 학습합니다. 클러스터 DNS, Service 객체, 마이크로서비스를 이름으로 접근할 수 있게 하는 확인 흐름을 다룹니다. 브라우저에서 직접 실행하는 실습 코드로 Linux Networking & TCP/IP for Developers을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Linux Networking & TCP/IP for Developers을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Linux Networking & TCP/IP for Developers은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.
“Kubernetes의 서비스 검색 및 DNS” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Linux Networking & TCP/IP for Developers 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Linux Networking & TCP/IP for Developers 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- Docker 네트워크 모드
- Kubernetes 네트워킹 기초
- 컨테이너의 네트워크 정책
- Kubernetes의 서비스 검색 및 DNS