K8s 레시피 – DNS Tester

  • Post author:
  • Post category:칼럼
  • Post comments:0 Comments
  • Post last modified:August 3, 2020

여기서 소개할 thomaschaaf/dns-tester는 간단한 node.js 프로그램이다. Kubernetes 운영 17개월의 성과와 교훈에서 말했듯 Kubernetes와 같은 분산시스템을 운영할 때는 네트워크를 안정시키는 것만큼 중요한 과업이 없다. 그리고 DNS 서비스는 네트워크의 중요한 축이다. 그러니 내 클러스터의 DNS 서비스가 얼마나 안정적인 확인할 필요가 있고 이 지점에서 dns-tester 의 쓸모가 드러난다.

dns-tester의 사용법은 간단하다. dns-tester를 띄우고 kubectl logs -f 명령어로 로그를 눈으로 확인하면 된다.

9600 8 '249s' '39lookups / s'
9700 8 '252s' '38lookups / s'
9800 8 '254s' '39lookups / s'
9900 8 '257s' '39lookups / s'
10000 8 '260s' '38lookups / s'
10100 8 '262s' '39lookups / s'
Lookup 10112 failed Error: DNS Timeout!
    at Timeout.fn [as _onTimeout] (/root/service/node_modules/await-timeout/dist/index.umd.js:112:25)
    at ontimeout (timers.js:427:11)
    at tryOnTimeout (timers.js:289:5)
    at listOnTimeout (timers.js:252:5)
    at Timer.processTimers (timers.js:212:10)

위와 같이 Error 가 발생하면 DNS 서비스가 충분히 안정적이라 할 수 없다. 대부분의 운영체제와 라이브러리에서 DNS 조회 타임아웃 값을 고정해놨기 때문에 애플리케이션 차원에서 Failover하기 어렵다는 점에서 DNS 서비스는 특히나 안정적일 필요가 있다. 그러니 dns-tester 에서 오류 메시지를 보지 않을 정도로 튜닝하기를 권한다.

dns-tester는 메트릭을 제공하지 않고 로그만 제공하여 다소 불편하다. 그래도 목적을 달성하는데는 충분히 유용하다.

레시피

# See https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/
apiVersion: apps/v1
kind: Deployment
metadata:
  name: dns-tester
  namespace: monitoring
  labels:
    app: dns-tester
spec:
  replicas: 1
  selector:
    matchLabels:
      app: dns-tester
  template:
    metadata:
      labels:
        app: dns-tester
    spec:
      containers:
        - name: dns-tester
          image: thomaschaaf/dns-tester:latest
          env:
            - name: DNS_NAME
              value: "kubernetes.default.svc.cluster.local"
            - name: DNS_NAME_TIMEOUT
              value: "300"
            - name: WAIT_BETWEEN_REQUESTS
              value: "50"
          resources:
            requests:
              memory: "16Mi"
              cpu: "50m"
            limits:
              memory: "128Mi"
              cpu: "1000m"

참고 자료

Author Details
Kubernetes, DevSecOps, AWS, 클라우드 보안, 클라우드 비용관리, SaaS 의 활용과 내재화 등 소프트웨어 개발 전반에 도움이 필요하다면 도움을 요청하세요. 지인이라면 가볍게 도와드리겠습니다. 전문적인 도움이 필요하다면 저의 현업에 방해가 되지 않는 선에서 협의가능합니다.
0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments